SQLSTATE 25P01 WARNING Class 25: Invalid Transaction State

no_active_sql_transaction there is no transaction in progress — 25P01

PostgreSQL error “there is no transaction in progress — 25P01” (SQLSTATE 25P01): 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 command that requires an open transaction (e.g. COMMIT, ROLLBACK, or ROLLBACK TO SAVEPOINT) was issued with no transaction in progress. PostgreSQL raises SQLSTATE 25P01 (no_active_sql_transaction). Often this appears as a warning for a stray COMMIT/ROLLBACK.

  • A transaction-control command ran with no open transaction.
  • Common with a stray COMMIT/ROLLBACK in autocommit mode.
  • There is nothing to commit or roll back.

What the server log shows

WARNING:  there is no transaction in progress

Why PostgreSQL raises this — what the manual says

the COMMIT reference (Description):

“COMMIT commits the current transaction.”

Transaction-control statements operate on an active transaction. With none open (autocommit), there is nothing to act on, so PostgreSQL reports 25P01 (a warning for stray COMMIT/ROLLBACK; an error for statements that strictly require a transaction).

Common causes

  • A stray COMMIT/ROLLBACK with no matching BEGIN.
  • Double-committing a transaction.
  • Autocommit mode where each statement already commits.

How to fix it

  1. Pair transaction control with an explicit BEGIN.
  2. Remove redundant COMMIT/ROLLBACK calls.
  3. Track transaction state in the application to avoid stray controls.

Related & next steps

Reference: PostgreSQL 18 — COMMIT.

Was this helpful?