high severityNeon Postgres (all AI agent tools using it, e.g., bash/psql connections, ORMs like Prisma/Drizzle)

Database connection failures with errors like "FATAL: remaining connection slots are reserved for non-replication superuser connections", "too many connections", or "query_wait_timeout" after queuing. Queries hang for ~2 minutes before failing. Connection spikes visible in monitoring exhaust limits.

Root cause

Neon Postgres enforces max_connections limit based on compute size (e.g., 104 for 0.25 CU free tier, 7 reserved for superuser). Direct connections quickly exhaust this. Even with PgBouncer pooling (up to 10k client conns), default_pool_size (90% of max_connections, e.g., ~97 per user/db) limits concurrent active transactions per user/database pair. Serverless/AI agents often create many short-lived connections without pooling, hitting these limits.

NeonPostgresPgBouncerconnection poolingmax_connectionsdefault_pool_sizequery_wait_timeoutserverless

Citations