Symptoms
The server could not write because the disk or tablespace is full.
- The error is written to the server log and returned to the client carrying
SQLSTATE 53100. - Any driver (libpq, JDBC, psycopg, npgsql, pgx) surfaces this code in its error object so you can branch on it programmatically.
- PL/pgSQL can trap it by name:
EXCEPTION WHEN disk_full THEN.
Environment
Severity: ERROR | PostgreSQL versions: 12, 13, 14, 15, 16, 17
Most often seen under load or on under-provisioned servers; correlate it with system metrics (CPU, memory, disk, connection count) at the time of the error.
Root Cause
A write failed for lack of free space on the data, WAL, or temp directory.
Common causes:
- Ordinary data growth.
- WAL piling up because archiving is failing or a replication slot is stale.
- Large temp files from big sorts or joins.
- Log files filling the volume.
Diagnostic Queries
Recovery
Steps to resolve 53100:
- Free space immediately: remove old logs/temp files or expand the volume.
- Check WAL bloat — a failing
archive_commandor an inactive replication slot prevents cleanup; fix archiving or drop the unused slot withpg_drop_replication_slot. - Reduce temp usage by tuning queries and
work_mem, or settemp_file_limit. - Alert on disk usage well before the volume fills.
Reference: PostgreSQL error codes — Class 53 (Insufficient Resources).
Thanks — noted. This helps keep the database accurate.