PostgreSQL Troubleshooting Toolkit
Use this PostgreSQL troubleshooting toolkit to diagnose connection exhaustion, locks and deadlocks, slow queries, replication lag, autovacuum bloat, and disk-full incidents.
Paste your error and get a triage plan.
Paste a log line, CLI error, stack trace, service failure, or config snippet and get a structured troubleshooting plan. Your snippet is carried straight into the AI Incident Response Assistant with PostgreSQL context prefilled.
Do not paste secrets, tokens, private keys, passwords, or customer data. Your snippet stays in your browser until you open the assistant.
Top 25 PostgreSQL Errors and Failure Modes
The production failures engineers hit most — each links to a full cause → fix → prevention guide.
FATAL: sorry, too many clients already
All available connection slots are in use, usually because clients open connections faster than they close them or no pooler sits in front of Postgres.
FATAL: too many connections for role
A specific role has hit its per-role CONNECTION LIMIT even though the server still has global slots free.
FATAL: remaining connection slots are reserved for superusers
Normal clients are locked out because the last few slots are held back by superuser_reserved_connections for emergency admin access.
could not connect to server: Connection refused
The client cannot reach Postgres because the server is down, bound to the wrong address, or blocked by listen_addresses, firewall, or the wrong port.
deadlock detected
Two or more transactions each hold a lock the other needs, so Postgres aborts one of them to break the cycle.
could not serialize access due to concurrent update
A SERIALIZABLE or REPEATABLE READ transaction hit a serialization failure and must be retried by the application.
out of shared memory
Postgres ran out of shared memory, most often because max_locks_per_transaction is too low for a workload touching many partitions or objects at once.
could not extend file / No space left on device
The data or WAL filesystem is full, so Postgres cannot extend relations and writes begin to fail.
canceling statement due to lock timeout
A statement waited longer than lock_timeout to acquire a lock and was aborted, typically during contended DDL or migrations.
canceling statement due to statement timeout
A query exceeded the configured statement_timeout and was killed to protect the server from runaway execution.
database is not accepting commands to avoid wraparound data loss
Transaction ID wraparound is imminent because autovacuum fell behind on freezing, forcing the database into a protective read-only state.
relation does not exist
A query references a table or view that is missing, misspelled, or not on the current search_path or schema.
permission denied for table / relation
The connecting role lacks the required GRANT on the object or its schema.
password authentication failed / pg_hba.conf rejects connection
Authentication failed due to a bad credential or a pg_hba.conf rule that does not match the client, database, user, or auth method.
SSL connection closed unexpectedly / SSL required
The TLS handshake failed or was dropped because of an sslmode mismatch, expired certificate, or a server that requires SSL.
invalid page in block (data/index corruption)
Postgres detected a corrupt page, usually from bad storage or an unclean shutdown, and may require reindexing or restore from backup.
duplicate key value violates unique constraint
An INSERT or UPDATE tried to write a value that collides with an existing unique or primary key, often a sequence or upsert issue.
canceling statement due to conflict with recovery
A query on a hot standby was cancelled because replay of the primary's changes conflicted with the reading transaction.
autovacuum not keeping up / table and index bloat
Dead tuples accumulate faster than autovacuum can reclaim them, inflating table and index size and degrading performance.
slow query / bad execution plan
A query runs far slower than expected due to missing indexes, stale statistics, or a planner misestimate choosing a poor plan.
replication lag / WAL bloat
A standby falls behind the primary or WAL accumulates on disk, risking stale reads, failover gaps, and a full pg_wal directory.
lock contention / could not obtain lock
Transactions pile up waiting on heavily contended row or table locks, stalling throughput even without a full deadlock.
idle in transaction session timeout / long-lived transactions guide coming soon
Sessions left open in a transaction hold locks and pin the xmin horizon, blocking vacuum and bloating the database.
out of memory / killed by OOM killer guide coming soon
A backend or the whole cluster is terminated when work_mem times concurrency or a large query exhausts host memory.
PANIC: could not write to WAL / checkpoint pressure guide coming soon
The server panics or stalls when it cannot write WAL, often from a full pg_wal volume, undersized max_wal_size, or overly frequent checkpoints.
Validate your config before you redeploy
Catch the structural mistakes that cause outages — 100% in your browser, nothing uploaded.
Best PostgreSQL Prompts
Turn symptoms, logs, and config into a structured plan with prompts tuned for PostgreSQL.
Postgres Lock Contention & Deadlock Investigation
Trace blocking chains and resolve deadlocks
Use this promptPostgres Vacuum, Bloat & Autovacuum Tuning
Tame bloat and tune autovacuum thresholds
Use this promptPostgres Index Advisor with pg_stat_statements
Recommend and prune indexes from real workload
Use this promptPostgres Statement Timeout & Runaway Query Governance
Set timeouts to cap runaway queries
Use this promptDownload the PostgreSQL Troubleshooting Runbook Pack
First-response checklists for a struggling Postgres instance — connections, locks, queries, replication, and vacuum.
- Connection exhaustion & pooling
- Locks & deadlock triage
- Slow query & EXPLAIN analysis
- Replication lag & WAL
- Autovacuum, bloat & wraparound
All PostgreSQL Troubleshooting Guides
Grouped by failure-mode type — each guide covers cause, fix, validation, and prevention.