SQLSTATE XX001 ERROR Class XX: Internal Error

data_corrupted could not access status of transaction N — XX001

PostgreSQL error "could not access status of transaction N" (SQLSTATE XX001): what it means, common causes, and how to fix it.

PG 12, 13, 14, 15, 16, 17, 18 Official docs
Last reviewed May 2025 Grounded in source

Diagnostic Queries

Symptoms

PostgreSQL could not read the commit status (from the clog / pg_xact)">pg_xact/clog area) for a transaction id it needed. This points to corruption of transaction-status data and raises SQLSTATE XX001 (data_corrupted).

  • A DETAIL usually names a missing/short clog file.
  • Indicates damage to pg_xact (commit log) or related SLRU data.
  • May surface during reads, vacuum, or visibility checks.

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

  • Corruption or loss of pg_xact/clog files.
  • A truncated or improperly restored data directory.
  • Transaction-id wraparound damage or storage faults.

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”.

Was this helpful?