Diagnostic Queries
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).
- A TOAST chunk row is missing.
- The wide value cannot be fully reassembled.
- Classic sign of TOAST-index or heap corruption.
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
- Corruption or loss of rows in the TOAST table.
- A damaged TOAST index that cannot locate chunks.
- Hardware faults or crashes with fsync disabled.
How to fix it
- REINDEX the TOAST index first — a bad index can cause this even when data is intact.
- If chunks are truly lost, restore from backup.
- Run hardware/filesystem checks and consider repairing the affected row after a backup.
Related & next steps
Reference: PostgreSQL 18 Section 73.2 “TOAST”.
Thanks — noted. This helps keep the database accurate.