Data Corrupted — SQLSTATE XX001

SQLSTATE XX001 condition data_corrupted class XX — Internal Error severity PANIC
Reproduced & verified on PostgreSQL 14.23, 15.18, 16.14, 17.10 and 18.4 — identical message on every version.
Last reviewed 29 May 2025 · Reproduced live with the SQL on this page.

! Symptoms Free

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.

1 Environment & reproduce Free

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 Free

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.

3 Recovery & verify Free

Steps to resolve XX001:

  1. Stop writing to the affected system and take a physical copy before any repair.
  2. Restore from a verified backup — this is the safe path.
  3. As a last resort, zero_damaged_pages can read past damage but discards corrupt pages and risks data loss; use only with guidance and a backup.
  4. Enable data checksums and ECC memory to catch problems earlier.

Reference: PostgreSQL error codes — Class XX (Internal Error).