invalid page in block N of relation …
SQLSTATE XX001 condition data_corrupted class XX — Internal Error severity ERROR
Reproduced & verified on PostgreSQL 14.23, 15.18, 16.14, 17.10 and 18.4 — identical message on every version.
Last reviewed 30 May 2025 · Reproduced live with the SQL on this page.
Symptoms
PostgreSQL read a data block whose page header failed validation — the page contents are not a valid PostgreSQL page. This indicates data corruption and raises SQLSTATE XX001 (data_corrupted).
- The page header/checksum did not validate.
- A strong signal of on-disk corruption.
- Queries touching the affected block fail.
What the server log shows
ERROR: invalid page in block 1234 of relation base/16384/24576
Why PostgreSQL raises this — what the manual says
Section 30.2 Data Checksums:
“Data pages are checksummed by default, and full page images recorded in WAL records are always checksum protected.”
Before using a page, PostgreSQL validates its header (and checksum if enabled). A page that fails this check is treated as corrupt and the read is aborted with XX001 to avoid acting on bad data.
Common causes
- Storage/hardware faults writing or returning bad blocks.
- OS or filesystem corruption.
- A crash with disabled
fsyncor unsafe write caches.
How to fix it
- Back up the data directory immediately; do not write more to the cluster.
- Investigate hardware/filesystem; enable data checksums on future clusters.
- Restore from backup/PITR; as a last resort, advanced recovery with
zero_damaged_pages(data loss) under expert guidance.
Related & next steps
Reference: PostgreSQL 18 Section 30.2 “Reliability”.