# "no more connections allowed": diagnose and fix

## Symptom
Connections rejected with `no more connections allowed` even though Postgres itself is not at `max_connections`.

## Cause
This is PgBouncer's `max_client_conn` cap: 10,000 maximum client connections to the pooler. A related, softer limit: each user+database pair gets `default_pool_size` (90% of `max_connections`) active backend slots and queues beyond that with a 2-minute timeout. So either one tenant is flooding, or the app genuinely holds 10k+ client connections.

## Confirm
1. Are you on the pooled string (`-pooler`)? This error only comes from the pooler.
2. Estimate client connections: instances x pool size per instance. Serverless with high per-instance pools is the classic cause.
3. Check whether it is one user/database pair (queueing, slow) or global (immediate rejection).

## Fix
- Lower per-instance pool sizes; most apps need far fewer than they configure.
- Fix connection leaks: every checkout must be released, on all code paths including errors.
- For genuinely huge fleets, split traffic across read replicas or more projects.
- Raising compute size raises `default_pool_size` (90% of max_connections) for the queueing case, but does not raise the 10,000 client cap.

## Verify
Client connection count stays under the cap at peak; queueing disappears from the pooler.