Symptoms
PostgreSQL detected corrupted data on disk.
- The error is written to the server log and returned to the client carrying
SQLSTATE XX001. - Any driver (libpq, JDBC, psycopg, npgsql, pgx) surfaces this code in its error object so you can branch on it programmatically.
Environment
Severity: PANIC | PostgreSQL versions: 12, 13, 14, 15, 16, 17
Indicates a system- or storage-level problem; inspect OS logs, disk health, and any recent hardware or filesystem changes.
Root Cause
A page failed verification (checksum or structural check) — the stored data is damaged.
Common causes:
- A bad disk or memory (non-ECC).
- Power loss without proper fsync.
- Filesystem or storage misconfiguration.
Diagnostic Queries
Recovery
Steps to resolve XX001:
- Stop writing to the affected system and take a physical copy before any repair.
- Restore from a verified backup — this is the safe path.
- As a last resort,
zero_damaged_pagescan read past damage but discards corrupt pages and risks data loss; use only with guidance and a backup. - Enable data checksums and ECC memory to catch problems earlier.
Reference: PostgreSQL error codes — Class XX (Internal Error).
Was this helpful?
Thanks — noted. This helps keep the database accurate.