Prisma Error P2024: Connection Pool Timeout

Prisma error P2024 (Connection Pool Timeout) explained: what it means, why it happens, and how to fix it — with copy-paste code examples.

Error code P2024 Prisma Last verified 2026-08-19

Quick Answer

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

Error code: P2024
Official name: Connection Pool Timeout
Service: Prisma

What does this error mean?

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})

Common Causes

How to Fix

  1. Check current pool timeout in the error message and raise it via the connection string (?connection_limit= or ?pool_timeout=)
  2. Profile slow queries - a handful of long queries can starve the whole pool
  3. Review code for un-awaited promises and queries fired inside .map() loops (use Promise.all deliberately)
  4. On serverless, route traffic through a connection pooler (PgBouncer/Supavisor/Prisma Accelerate)
  5. Reduce the number of concurrent connections with ?connection_limit= when the database enforces a hard cap

Code Examples

Tune pool via connection string bash
# 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.

Promise.all instead of sequential awaits typescript
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.

Framework-Specific Fixes

prisma-accelerate

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"
nestjs

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

You Might Also Like

Frequently Asked Questions

Why am I seeing Prisma error P2024?

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.

How do I fix Prisma error P2024?

Check current pool timeout in the error message and raise it via the connection string (?connection_limit= or ?pool_timeout=).

Which frameworks have documented fixes for error P2024?

This page documents fixes for: prisma-accelerate, nestjs.

Official Sources

This page is based on the official Prisma documentation linked below and adds practical troubleshooting guidance on top.