Prisma error P2024 (Connection Pool Timeout) explained: what it means, why it happens, and how to fix it — with copy-paste code examples.
Check current pool timeout in the error message and raise it via the connection string (?connection_limit= or ?pool_timeout=). If that does not apply, profile slow queries - a handful of long queries can starve the whole pool — the full checklist is below.
Error code: P2024
Official name: Connection Pool Timeout
Service: Prisma
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})
# postgresql provider
DATABASE_URL="postgresql://user:pass@host:5432/db?connection_limit=20&pool_timeout=15"
connection_limit caps concurrent connections; pool_timeout is the wait in seconds before P2024.
const rows = await Promise.all(
ids.map((id) => prisma.item.findUnique({ where: { id } })),
)
// keep the pool small: parallel, not serial
Awaiting in a loop holds one connection per iteration for the whole duration - Promise.all finishes in one round-trip.
Point DATABASE_URL at Prisma Accelerate for serverless so the pool lives in the cloud, not per-invocation.
DATABASE_URL="prisma+postgres://accelerate.prisma-data.net/?api_key=YOUR_KEY"
Tune the pool in the PrismaService constructor: connection_limit and pool_timeout are query params on the datasource URL.
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
// DATABASE_URL=postgresql://...?connection_limit=20&pool_timeout=15
Most often this happens when burst traffic exceeds the pool size (default 100 on PostgreSQL with pooler, 1-10 elsewhere), or when slow queries holding connections open longer than the pool timeout.
Check current pool timeout in the error message and raise it via the connection string (?connection_limit= or ?pool_timeout=).
This page documents fixes for: prisma-accelerate, nestjs.
Recommendations are editorial — DB Error Reference takes no payment or affiliate fees for tool listings.
This page is based on the official Prisma documentation linked below and adds practical troubleshooting guidance on top.