SQLSTATE XX001 ERROR Class XX: Internal Error

data_corrupted corrupted two-phase state in memory for transaction n of epoch n — XX001

PostgreSQL error “corrupted two-phase state in memory for transaction n of epoch n” (SQLSTATE XX001, data_corrupted): what it means, common causes, and how to fix it.

Last reviewed Jun 2026 Grounded in source
Production impact High Competency WAL & Recovery Career Own backup and recovery strategy Frequency Common

Investigation

Symptoms

A statement failed with SQLSTATE XX001 (data_corrupted), reported at severity ERROR. This is a Internal Error condition: PostgreSQL emits the message corrupted two-phase state in memory for transaction n of epoch n.

  • The client receives SQLSTATE XX001 (data corrupted).
  • The operation is rejected at ERROR level; the statement does not complete.

What the server log shows

ERROR:  corrupted two-phase state in memory for transaction n of epoch n

Why PostgreSQL raises this

Class XX (Internal Error) indicates a condition that should not normally occur — often a sign of data corruption or a server bug. These warrant careful investigation.

As described in PostgreSQL’s Chapter 30 Reliability and the Write-Ahead Log and Appendix A (PostgreSQL Error Codes), SQLSTATE XX001 carries the condition name data_corrupted in class Internal Error. (Paraphrased — see the linked reference for the exact wording.)

Common causes

  • Data or index corruption (often storage/hardware related).
  • An unexpected internal state or a server bug.
  • A failed consistency check during execution.

How to fix it

  1. Capture the full message, context, and server version.
  2. Check storage/hardware and recent crash history.
  3. Take a backup and consider reporting a reproducible case upstream.

Version applicability

This message text is present in PostgreSQL 19. It was introduced around PostgreSQL 19; earlier releases do not emit this exact text.

Related & next steps

Reference: PostgreSQL Chapter 30 Reliability and the Write-Ahead Log.

Keep going

Related & next steps

Was this helpful?