SQLSTATE XX001 ERROR Class XX: Internal Error

data_corrupted invalid page in block N of relation … — XX001

PostgreSQL error “invalid page in block N of relation … — XX001” (SQLSTATE XX001): what it means, common causes, and how to fix it.

PG 9.6, 10, 11, 12, 13, 14, 15, 16, 17, 18 Official docs
Last reviewed Jun 2026 Grounded in source

Diagnostic Queries

Symptoms

PostgreSQL read a data page that failed its validity/checksum checks. This indicates corruption, so it raises SQLSTATE XX001 (data_corrupted).

  • A page in a relation failed validation.
  • Often a checksum failure or a torn/garbage page.
  • Reads of the affected block fail.

What the server log shows

ERROR:  invalid page in block 12345 of relation base/16384/24576

Why PostgreSQL raises this — what the manual says

the Data Checksums documentation:

“By default, data pages are protected by checksums, but this can optionally be disabled for a cluster.”

Each page carries structural fields (and optionally a checksum). When a read finds an invalid header or checksum mismatch, PostgreSQL refuses to return possibly corrupt data and reports XX001.

Common causes

  • Storage/hardware faults corrupting pages.
  • Crashes with fsync disabled, or a bad restore.
  • Bit rot or controller/firmware bugs.

How to fix it

  1. Investigate hardware/storage health immediately.
  2. Restore the affected relation/database from a known-good backup.
  3. As a last resort, zero_damaged_pages can read past it (data loss) — back up first and use with extreme care.

Related & next steps

Reference: PostgreSQL 18 Section 30.2 “Data Checksums”.

Was this helpful?