SQLSTATE 57000 ERROR Class 57: Operator Intervention

operator_intervention Operator Intervention — SQLSTATE 57000

SQLSTATE 57000 (operator_intervention): The statement or session was canceled or terminated by timeout, admin, or shutdown.

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

Symptoms

The server reports SQLSTATE 57000 (operator_intervention), a condition in the Operator Intervention class.

  • The error is written to the server log and returned to the client carrying SQLSTATE 57000.
  • Any driver (libpq, JDBC, psycopg, npgsql, pgx) surfaces this code in its error object so you can branch on it programmatically.
  • PL/pgSQL can trap it by name: EXCEPTION WHEN operator_intervention THEN.

Environment

Severity: ERROR  |  PostgreSQL versions: 12, 13, 14, 15, 16, 17

Commonly coincides with restarts, failover, maintenance, or network events; check server uptime and the log around the timestamp.

Root Cause

57000 belongs to Class 57 — Operator Intervention. In this class, the statement or session was canceled or terminated by timeout, admin, or shutdown.

The first two characters (57) identify the error class, so application code can match the whole class via 57000 when the specific code is not needed.

Diagnostic Queries

Recovery

Optimize slow queries and tune statement_timeout, expect cancellations during failover/maintenance, and add automatic retry/reconnect logic.

Reference: PostgreSQL error codes — Class 57 (Operator Intervention).

Was this helpful?