could not access status of transaction 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 read the commit status (from the pg_xact/clog area) for a transaction id it needed. This points to corruption of transaction-status data and raises SQLSTATE XX001 (data_corrupted).

What the server log shows

ERROR:  could not access status of transaction 1234567
DETAIL:  Could not open file "pg_xact/0001": No such file or directory.

Why PostgreSQL raises this — what the manual says

As Section 66.1 Database File Layout explains:

PostgreSQL could not read a transaction’s commit/abort status from the pg_xact (transaction commit log) subdirectory under the data directory — typically a symptom of data corruption or a missing or truncated commit-log segment; investigate disk integrity and recent crashes before continuing.

To decide tuple visibility, PostgreSQL must look up each transaction’s commit status in pg_xact. If that data is missing or unreadable, visibility cannot be determined and it reports XX001.

Common causes

How to fix it

  1. Back up the data directory before attempting recovery.
  2. Restore from a consistent backup/PITR — the most reliable fix.
  3. For wraparound issues, ensure aggressive vacuuming; advanced clog repair only under expert guidance (risk of data loss).

Related & next steps

Reference: PostgreSQL 18 Section 76.1 “Database File Layout”.