SQLSTATE 3B000 ERROR Class 3B: Savepoint Exception

savepoint_exception prepared transaction with identifier “…” does not exist — 3B000

PostgreSQL error “prepared transaction with identifier … does not exist — 3B000” (SQLSTATE 3B000): what it means, common causes, and how to fix it.

PG 9.6, 10, 11, 12, 13, 14, 15, 16, 17, 18 Official docs
Last reviewed Jun 2026 Grounded in source

Diagnostic Queries

Symptoms

A COMMIT PREPARED/ROLLBACK PREPARED referenced a two-phase transaction identifier that does not exist. PostgreSQL raises SQLSTATE 3B000 (savepoint_exception).

  • The named prepared (2PC) transaction isn’t present.
  • Common after it was already committed/rolled back.
  • Often a transaction-manager bookkeeping mismatch.

What the server log shows

ERROR:  prepared transaction with identifier "txn-001" does not exist

Why PostgreSQL raises this — what the manual says

the COMMIT PREPARED reference (Description):

“commit a transaction that was earlier prepared for two-phase commit”

Prepared (two-phase) transactions are tracked by a global identifier in pg_prepared_xacts. Referencing an id that was never prepared (or already finalized) cannot be resolved, so PostgreSQL reports 3B000.

Common causes

  • The prepared transaction was already committed/rolled back.
  • A typo or stale id in the transaction manager.
  • Connecting to the wrong cluster/node.

How to fix it

  1. List prepared transactions: SELECT gid FROM pg_prepared_xacts; and use a valid id.
  2. Make the transaction manager track 2PC state accurately.
  3. Verify you are on the correct database server.

Related & next steps

Reference: PostgreSQL 18 — COMMIT PREPARED.

Was this helpful?