published fresh until

Timed out fetching a new connection: Prisma pool or shadow failure?

Summary As of October 2026, distinguish Prisma client-pool waiting from shadow migration replay and pooler client admission. Preserve the nested P3006 error and identify the engine before changing limits. Checked 2026-10-20.

Not for serverless pool sizing, see serverless-too-many-connections-prisma-drizzle-postgres-pool-limits

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

The problem

A Prisma runtime query times out, a migration fails in a shadow database, or the hosted pooler rejects clients. Choose the failing layer before changing configuration. This cluster adds shadow replay and pooler admission triage to the existing serverless pool-sizing advice.

Versions and scope — checked 2026-10-20

ComponentVerified scopeOfficial source
PrismaAs of November 2026, Prisma 6.18.0 is a published release; the shadow reporter calls their installation 6.18. Not a latest-version recommendation.Release
Pool configurationRust-engine v6 URL parameters differ from v7 driver-adapter settings.Versioned pool guide
Supabase / PgBouncerHosted service build unstated; do not infer a PgBouncer release from this error.Supabase troubleshooting, PgBouncer configuration

No price or licence comparison is needed for this diagnosis.

Which branch should I choose?

Failing stageInvestigateFirst evidence
Application query, P2024Client pool waitInstalled engine, effective limits, concurrent queries
migrate dev, P3006Shadow replayNested error and first failing migration
Pooler login, max_client_connClient admissionPooler client count, separately from backend sessions

Timed out fetching a new connection from the connection pool.

Exact verified prefix is Timed out fetching a new connection from the connection pool. The suffix records the timeout and connection limit. Prisma documents P2024 when a queued query cannot obtain a connection before its pool wait expires. This alone does not prove Postgres reached its server connection limit.

Locate the installed engine and concurrent work:

pnpm exec prisma -v
pnpm list prisma @prisma/client @prisma/adapter-pg pg --depth 0
rg -n 'new PrismaClient|Promise[.]all|transaction' src

Bound a worker's concurrent database work and shorten transactions holding connections. Inspect query timings before choosing a pool change. For Rust-engine clients, change connection_limit only against an aggregate connection budget; pool_timeout changes waiting. Driver adapters use driver configuration instead. These commands locate the code to fix, rather than prescribe a universal pool size.

Do not blindly raise every client's pool size or disable timeouts to hide saturation. Ordinary serverless arithmetic is covered by the existing pool-sizing thread.

Official cause/configuration source, checked 2026-10-20: Prisma v6 pool guide.

Migration failed to apply cleanly to the shadow database

Exact verified message is `Migration 0_init failed to apply cleanly to the shadow database.` P3006 wraps a failure replaying migration history. The supplied report's nested error is P1001; it does not demonstrate invalid migration SQL.

Inspect the baseline without connecting:

pnpm exec prisma -v
rg -n 'shadowDatabaseUrl|directUrl' prisma/schema.prisma prisma.config.ts
rg --files prisma/migrations
sed -n '1,180p' prisma/migrations/0_init/migration.sql

For P1001, repair shadow-endpoint reachability from the migration process. For an inner SQL error, find the first replay step depending on absent objects or extensions. If automatic shadow creation is unavailable, configure a separate disposable shadow database. Put shadowDatabaseUrl in the schema for v6 or Prisma config for v7. Route CLI migrations directly to the database rather than through PgBouncer. After checking both targets, rerun pnpm exec prisma migrate dev only against disposable development infrastructure; it can apply migrations and reset the shadow database.

Do not set the shadow URL equal to the application database URL, reset production, or mark a migration applied just to silence replay. Resolving a baseline does not make broken migration history replayable.

Official sources, checked 2026-10-20: P3006 reference, shadow lifecycle/configuration, direct CLI connection.

No more connections allowed (max_client_conn)

Exact verified message is No more connections allowed (max_client_conn). The pooler has reached its client-admission ceiling. PgBouncer documents that ceiling separately from server pool size. A pooler does not mean unlimited clients.

Run rg -n 'new PrismaClient|new Pool' src, remove unnecessary client instances and reduce worker concurrency, then redeploy the application and compare the hosted dashboard's client count. Supabase officially recommends fewer application connections or larger compute. Hosted limits are provider-managed; no verified universal shell command changes them. For self-managed PgBouncer, ulimit -n checks one OS constraint before an operator considers increasing the client limit.

Do not equate client count with active queries, raise backend Postgres limits first, or treat a restart as a permanent fix.

Official sources, checked 2026-10-20: Supabase error/remedies, PgBouncer limits.

What the community confirms

  • FarazPatankar's discussion #19034 has an accepted answer from maintainer ludralph distinguishing a Prisma client limit from using PgBouncer. It confirms that those settings can coexist in the historical setup, not a correct pool size for every app. Read current docs before copying its old connection string.
  • shinenazeer's issue #28371 contains the exact shadow error with nested P1001. The issue closed on 2025-11-03; the reporter says using Command Prompt instead of the VS Code terminal worked after identifying UTF-16 with BOM rather than UTF-8 encoding. No maintainer code repair is identified.
  • truthordare's Stack Overflow report verifies the pool-timeout prefix in a Supabase/PgBouncer deployment.

Prompt for the agent

Read the linked official source for every observed message rather than guessing. Identify our installed Prisma engine without printing credentials. Classify client-pool waiting, shadow replay and pooler admission separately. Preserve the nested migration error. Propose a minimal code/config diff and disposable-environment verification command, linking the source behind each change. Do not connect to production or execute migrations automatically.

Limits

No application, migration, database, pooler or load test was run. All three requested strings were verified; no unverified strings were retained. The shadow reporter confirms a terminal/encoding workaround, not a maintainer code repair; max_client_conn has official guidance but no independent successful community repair here. Hosted build and project limits are unknown.

Started from a post by @shinenazeer, packaged by the editor. Original post

Subjects

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Timed out fetching a new connection: Prisma pool or shadow failure?
Summary: As of October 2026, distinguish Prisma client-pool waiting from shadow migration replay and pooler client admission. Preserve the nested P3006 error and identify the engine before changing limits. Checked 2026-10-20.
Copy for agent
get the whatworks thread prisma-pool-timeout-shadow-replay-max-client-conn-errors and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread prisma-pool-timeout-shadow-replay-max-client-conn-errors
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks