Prisma error P2024: connection pool timeout
P2024 means Prisma did reach the database and open a pool, but every connection in that pool was already busy when your query asked for one, and none freed up before the configured timeout. That is different from P1001 (never reached the server at all) and P2037 (the database itself refused more connections).
Last checked November 18, 2026.
The exact message
Prisma's error reference documents the message template as:
Timed out fetching a new connection from the connection pool.
(More info: http://pris.ly/d/connection-pool)
(Current connection pool timeout: {timeout}, connection limit: {connection_limit})Sources: Prisma: Error message reference
P2024 vs the other connection error codes
| Code | Meaning |
|---|---|
| P1001 | Could not reach the database server at all — no response from host:port. |
| P2024 | Reached the server and the pool; every pool connection was busy past the configured timeout. |
| P2037 | Reached the server; the database itself refused to open more connections ("too many database connections opened"). |
Sources: Prisma: Error message reference
The real causes, most common first
- connection_limit is set too low for real concurrency (Prisma's default is based on CPU count, which is often far lower than the concurrent requests a serverless deployment actually sees).
- A connection leak: a long-running or unawaited query holds a pool slot past when it should have released it, so the pool looks full even under light load.
- The database's own max_connections (or a pooler in front of it) is smaller than Prisma's configured connection_limit, so Prisma thinks it has more room than the server will actually allow.
- A serverless deployment creating a new PrismaClient (and a new pool) per invocation instead of reusing one across invocations, multiplying the real connection count far beyond connection_limit.
Sources: Prisma: Error message reference
The fix
- Reuse one PrismaClient instance per process (a module-level singleton) instead of creating a new one per request or per serverless invocation.
- Raise connectionTimeout and pool_timeout in the connection string if the database can genuinely support more concurrent connections, or lower connection_limit if the database's own max_connections is the real ceiling.
- Point Prisma at a pooled connection string (PgBouncer/Supavisor-style) instead of a direct one when running in a serverless or edge environment with many short-lived instances.
- Add Prisma's own slow-query or connection-pool metrics (if available on your plan) to find exactly which query is holding connections open longest.
Sources: Prisma: Error message reference
Using Prisma against Scribase
Scribase exposes a pooled Postgres connection string from the console. Point DATABASE_URL at it and set connection_limit to a value the pool can comfortably support; the same singleton-PrismaClient pattern that avoids P2024 on any host applies here too.
Sources: Scribase pricing
Questions people ask
What is the difference between P2024 and P1001?
P1001 means Prisma never got a response from the database host and port at all. P2024 means Prisma did connect and open a pool, but every connection in it was busy past the configured timeout.
Why does P2024 only happen under load?
The pool has a fixed number of connections (connection_limit). Under light load there is always a free one; under heavier concurrent load, requests start queuing for a connection, and if none frees up before pool_timeout, Prisma raises P2024.
Does raising connection_limit always fix it?
Only if the database itself can actually support more connections. Raising connection_limit past the database's (or its pooler's) own max_connections just trades P2024 for P2037, "too many database connections opened."
Does Scribase work with Prisma?
Yes, through the pooled Postgres connection string from the Scribase console, the same way Prisma connects to any hosted Postgres database.