index “…” contains unexpected zero page

SQLSTATE XX002 condition index_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 11 Jun 2026 · Reproduced live with the SQL on this page.

Symptoms

An index access found an unexpected zero (all-zero) page, indicating index corruption. PostgreSQL raises SQLSTATE XX002 (index_corrupted).

What the server log shows

ERROR:  index "orders_pkey" contains unexpected zero page at block 99

Why PostgreSQL raises this — what the manual says

As the REINDEX reference (Description) explains:

The index’s on-disk structure is inconsistent with the underlying table — commonly caused by storage faults, collation-library changes, or an unclean shutdown; REINDEX rebuilds the index from scratch to restore a valid structure.

Index pages must be properly initialized. Encountering an all-zero page where data is expected means the index structure is damaged, so PostgreSQL reports XX002. Because indexes are derived data, they can usually be rebuilt.

Common causes

How to fix it

  1. Rebuild the index: REINDEX INDEX CONCURRENTLY orders_pkey;.
  2. Use amcheck to scan for other corrupt indexes.
  3. Investigate the underlying storage; indexes corrupting repeatedly signal hardware issues.

Related & next steps

Reference: PostgreSQL 18 — REINDEX.