Database Errors
Connections, deadlocks, constraints, replication and memory limits.
Understanding Database errors
Database errors group into connection exhaustion, lock contention and deadlocks, constraint violations, and resource limits. Connection errors under load are the most misdiagnosed: "too many connections" is almost never fixed by raising max_connections, because each connection costs memory. It is fixed by putting a pooler in front and finding the code path that leaks connections.
How to debug Database errors
- Look at what the server currently sees:
SELECT * FROM pg_stat_activityin PostgreSQL,SHOW FULL PROCESSLISTin MySQL. Sessions sitting inidle in transactionare the usual culprit behind connection exhaustion. - For deadlocks, read the deadlock report the database logs. It names both transactions and the exact lock order. The fix is nearly always to make all code paths acquire locks in the same order.
- Check whether the error is from the database or from a pooler. PgBouncer, ProxySQL and RDS Proxy return their own errors that look database-native but need pooler-side fixes.
- Run
EXPLAIN (ANALYZE, BUFFERS)on slow queries. Lock-wait timeouts are often just very slow queries holding locks longer than they should. - Verify you are connected to the writer, not a read replica.
READONLYand "cannot execute in a read-only transaction" errors mean traffic is reaching the wrong endpoint.
Tools worth reaching for
pg_stat_activitySHOW ENGINE INNODB STATUSEXPLAIN ANALYZEslow query logpgbadger
All 41 Database errors
- Cassandra: NoHostAvailableThe driver could not reach any node: wrong contact points, the node is down, a datacenter/consistency mismatch, or…
- ClickHouse: Memory limit (total) exceededA query tried to use more memory than max_memory_usage (or the server total) allows, common with large GROUP…
- CockroachDB: restart transaction (SQLSTATE 40001)A SerialisABLE transaction conflicted and must be retried. Contended transactions can be aborted with a retry error.
- DynamoDB: ProvisionedThroughputExceededExceptionThe table or a hot partition exceeded its read/write capacity. A skewed partition key can throttle even when overall…
- Elasticsearch: flood stage disk watermark exceededDisk usage >95%. Node effectively read-only to prevent data corruption. Requires manual reset even after freeing space.
- Elasticsearch: mapper_parsing_exception, failed to parse field NewA document's value does not fit the field's mapped type. Dynamic mapping fixes a type from the first document it sees…
- Elasticsearch: Shard allocation failedCannot allocate shards to nodes. Disk space low, node disconnected, or allocation settings restrictive.
- MongoDB: E11000 duplicate key errorAn insert or upsert violated a unique index. Common during retries, imports, or migrations that do not account for…
- MongoDB: Server selection timed out NewThe driver could not find a suitable server within serverSelectionTimeoutMS. With Atlas this is nearly always IP…
- MongoDB: Transaction numbers are only allowed on a replica set member or mongos NewRetryable writes and multi document transactions need an oplog, which a standalone mongod does not have. The driver…
- MongoDB: Write concern errorWrite operation failed to meet specified write concern. Replica set nodes unavailable or acknowledgment timeout.
- MySQL server has gone away (error 2006)The client lost its connection to MySQL, often because an idle pooled connection timed out, max_allowed_packet was too…
- MySQL: Authentication plugin 'caching_sha2_password' cannot be loaded NewMySQL 8 made caching_sha2_password the default authentication plugin. An older client library that only implements…
- MySQL: Duplicate entry 'x' for key 'PRIMARY' NewAn insert collided with an existing row on the primary key or another unique index. Beyond the obvious retry, it…
- MySQL: Incorrect string value (utf8mb4 / emoji) NewA four-byte UTF-8 character, most often an emoji, was inserted into a column using MySQL's legacy three-byte 'utf8'…
- MySQL: Lock wait timeout exceeded; try restarting transactionInnoDB could not acquire a row lock before innodb_lock_wait_timeout because another transaction was holding it…
- MySQL: Table 'db.Users' doesn't exist NewOn Linux, table names are case sensitive because they are filenames, while macOS and Windows are not. Code that writes…
- MySQL: Too many connectionsMaximum number of concurrent connections reached. Connection pool exhausted or connection leak.
- Oracle: ORA-12541: TNS:no listenerThe client reached the host but no listener is accepting on that port/service. The listener is down or the…
- pg_dump: server version mismatch, aborting Newpg_dump refuses to dump a server newer than itself, because it cannot know about catalog changes made after it was…
- PgBouncer: no more connections allowed (max_client_conn)PgBouncer rejected a client because max_client_conn was reached, or the server pool (default_pool_size) is exhausted…
- PgBouncer: prepared statement already exists NewIn transaction pooling mode a client can land on a different server connection each transaction. A driver that caches…
- PostgreSQL: canceling statement due to lock timeout NewThe statement waited longer than lock_timeout for a lock another transaction held. This is usually a migration queuing…
- PostgreSQL: canceling statement due to statement timeout NewThe query ran longer than statement_timeout and was cancelled by the server. This is a guardrail doing its job. The…
- PostgreSQL: cannot execute INSERT in a read-only transaction NewThe connection landed on a standby, or on a primary that has been demoted or put into read only mode. After a failover…
- PostgreSQL: could not resize shared memory segment, No space left on device NewPostgres allocates workspace for parallel queries in /dev/shm, and containers default that mount to 64 MB. The disk is…
- PostgreSQL: could not serialize access due to concurrent update NewTwo transactions running at REPEATABLE READ or SERIALIZABLE touched the same rows and PostgreSQL aborted one to…
- PostgreSQL: Deadlock detectedTwo or more transactions are waiting for each other to release locks, creating a deadlock.
- PostgreSQL: FATAL: password authentication failed for userAuthentication failed for the Postgres user. Password mismatch or pg_hba.conf configuration issue.
- PostgreSQL: relation "x" does not exist NewThe table exists but is not on the connection's search_path, or the name was created with quotes and is therefore…
- PostgreSQL: too many connectionsAll available Postgres connections are in use. Connection pool exhaustion or insufficient max_connections.
- Prisma: Unique constraint failed on the fields: (`x`)Attempted to create a record with a value that already exists in a unique column (P2002).
- Redis Cluster: CROSSSLOT Keys in request don't hash to the same slot NewA multi key command touched keys living on different shards. Redis Cluster splits the keyspace into 16384 slots by…
- Redis: Max clients reachedRedis has reached maximum number of client connections. Need to close connections or increase limit.
- Redis: NOAUTH Authentication required NewThe server has requirepass or ACL users configured and the client sent a command before authenticating. Managed Redis…
- Redis: OOM command not allowed when used memory > 'maxmemory'Redis has reached maximum memory limit and cannot accept write operations.
- Redis: READONLY You can't write against a read only replicaClient connected to Redis replica with read-only mode. Writes are rejected.
- Redis: WRONGTYPE Operation against a key holding the wrong kind of value NewThe key exists but holds a different type from the one the command expects, for instance GET against a hash. In…
- SQL Server: Transaction was deadlocked (Msg 1205)SQL Server chose your transaction as the deadlock victim after two or more sessions blocked each other in a cycle.
- SQLite: database is locked (SQLITE_BUSY)Another process or transaction is holding SQLite's write lock. SQLite allows many readers but only one writer at a time.
- Supabase/Postgres: new row violates row-level security policyAn insert/update was blocked because no RLS policy permits it for the current role, or the JWT lacks the expected…
Other categories
- AI 35Rate limits, context windows, GPU memory and model-serving failures.
- Ansible 10Unreachable hosts, become passwords, undefined variables and Jinja2 failures.
- API 14Auth headers, payload limits, versioning, idempotency and webhook signatures.
- Apple 10Command line tools, dyld, Homebrew permissions, notarisation and Keychain.
- Auth 11OIDC, SAML, Auth0, Okta, Keycloak, passkeys and MFA failures.
- BigData 11Spark, Kafka, Airflow, Snowflake, Flink and Databricks failures.
- C# 12NuGet restore, null references, EF Core migrations, async deadlocks and Blazor…
- C++ 11Segfaults, linker errors, memory corruption and template deduction failures.
- Caching 10Cache stampedes, stale content, Varnish and CloudFront failures.
- CI/CD 18GitHub Actions, GitLab CI, Jenkins, CircleCI: permissions, runners and…
- Client 21CORS, mixed content, module resolution, memory limits and framework runtime…
- Cloud 25IAM permissions, quotas, service limits and credential failures.
- Dart 10Null safety, pub version solving and build toolchain problems.
- DNS 10NXDOMAIN, SERVFAIL, timeouts, propagation and delegation problems.
- Docker 27Daemon connectivity, disk space, image pulls, ports and architecture mismatches.
- Elixir 9GenServer timeouts, supervision failures and Mix compilation problems.
- Email 8Delivery failures, relay denial, authentication, SPF, DKIM and DMARC.
- Frontend 23Hydration mismatches, bundler resolution, layout shift and font loading.
- Git 20Merge conflicts, rejected pushes, detached HEAD, LFS and repository corruption.
- Go 19Nil map assignment, concurrent map access, context cancellation and deadlocks.
- GraphQL 13Validation, depth limits, N+1 queries and fragment problems.
- gRPC 10Status codes, deadlines, message limits, TLS and HTTP/2 transport failures.
- HTTP 494xx client errors, 5xx server errors, redirects, headers and protocol problems.
- ICMP 23Destination unreachable, time exceeded, fragmentation needed and redirects.
- Ingress 8404 default backend, missing TLS secrets, IngressClass and path matching.
- Java 19Class loading, dependency resolution, connection pools and JVM version…
- JavaScript 42npm resolution, async pitfalls, hydration, memory limits and runtime type…
- Kubernetes 34CrashLoopBackOff, ImagePullBackOff, OOMKilled, RBAC, scheduling and storage.
- Logging 9Log4j, Logback, Fluentd, Logstash and CloudWatch ingestion problems.
- MessageQueue 14Kafka, RabbitMQ, SQS, NATS and Celery: lag, rebalancing and poison messages.
- Mobile 17Gradle, CocoaPods, Xcode signing, Metro bundler and toolchain mismatches.
- Monitoring 12Prometheus scrapes, Grafana data sources, OpenTelemetry exporters and agent…
- Network 35Refused connections, timeouts, resets, MTU problems and port exhaustion.
- Performance 6GC pauses, thread pool starvation and event loop blocking.
- PHP 11Memory limits, execution timeouts, autoloading, Composer and PDO connections.
- Proxy 17nginx, Envoy, HAProxy, Traefik, Caddy and Cloudflare upstream failures.
- Python 35Imports, virtual environments, encoding, concurrency and dependency conflicts.
- Regex 8Catastrophic backtracking, back references, escaping and engine differences.
- Ruby 11Bundler, migrations, native extensions, encoding and asset compilation.
- Rust 19Borrow checker, ownership moves, trait bounds and lifetime mismatches.
- Scala 6Dependency resolution, binary compatibility and type inference failures.
- Security 25JWT validation, CSRF, OAuth grants, SELinux, SSH host keys and CSP.
- Serverless 11Lambda timeouts, package size limits, VPC networking and cold starts.
- Shell 13Command not found, permissions, quoting, expansion and Makefile syntax.
- Storage 13S3 permissions, NFS mounts, quotas, signed URLs and volume attachment.
- Svelte 10Store subscriptions, load functions and server/client boundaries.
- System 26Disk space, systemd units, file descriptors, OOM killer and scheduled jobs.
- Terraform 18State locks, provider auth, drift, dependency cycles and plan-time unknowns.
- Testing 18Jest, pytest, JUnit, Cypress and Playwright: fixtures, snapshots and timeouts.
- TLS 24Untrusted authorities, expiry, hostname mismatch, chains and cipher negotiation.
- TypeScript 19Assignability, missing declarations, strict null checks and generic constraints.
- Virtualization 8VirtualBox, VMware, Hyper-V, WSL, KVM and hypervisor conflicts.
- Web3 7Gas estimation, nonce management and reverted transactions.
- WebAssembly 7Compile errors, memory bounds and host binding mismatches.
- WebServer 10nginx, Apache, IIS and Caddy: binding, permissions, rewrites and TLS.
- Windows 10Installer failures, missing runtimes, update errors and permission problems.