missing chunk number N for toast value N in pg_toast_N

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 could not find an expected chunk of an out-of-line TOAST value. The data is corrupt or incomplete, so it raises SQLSTATE XX001 (data_corrupted).

What the server log shows

ERROR:  missing chunk number 0 for toast value 24601 in pg_toast_16390

Why PostgreSQL raises this — what the manual says

Section 66.2.1 Out-of-Line, On-Disk TOAST Storage:

“Each chunk is stored as a separate row in the TOAST table belonging to the owning table.”

Reassembling a TOASTed value requires every chunk. A missing chunk (lost row or a corrupt TOAST index that can’t find it) makes reconstruction impossible, so PostgreSQL reports XX001.

Common causes

How to fix it

  1. REINDEX the TOAST index first — a bad index can cause this even when data is intact.
  2. If chunks are truly lost, restore from backup.
  3. Run hardware/filesystem checks and consider repairing the affected row after a backup.

Related & next steps

Reference: PostgreSQL 18 Section 73.2 “TOAST”.