SQLSTATE 57P03 FATAL Class 57: Operator Intervention

cannot_connect_now the database system is in recovery mode — 57P03

PostgreSQL error "the database system is in recovery mode" (SQLSTATE 57P03): 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

The server is in recovery (replaying WAL after a crash, or running as a standby) and cannot accept the requested connection. PostgreSQL reports SQLSTATE 57P03 (cannot_connect_now).

  • Appears after a crash while WAL is being replayed.
  • On a standby without hot standby enabled, all connections are refused.
  • Transient for crash recovery; persistent on a non-hot standby.

What the server log shows

FATAL:  the database system is in recovery mode

Why PostgreSQL raises this — what the manual says

Section 26.4.1 User’s Overview:

“the server will not accept connections until it has completed sufficient recovery to provide a consistent state against which queries can run.”

During recovery the cluster is not yet consistent for normal use. Unless hot standby is enabled (allowing read-only queries), connection attempts are rejected with 57P03 until recovery finishes or the standby is promoted.

Common causes

  • Crash recovery in progress after an unclean shutdown.
  • A physical standby with hot_standby = off.
  • A long archive-recovery during PITR.

How to fix it

  1. Wait for crash recovery to complete, then retry.
  2. Enable hot_standby = on if you want read queries on the standby.
  3. Promote the standby if it should become primary.

Related & next steps

Reference: PostgreSQL 18 Section 27.4 “Hot Standby”.

Was this helpful?