SQLSTATE 57P03 FATAL Class 57: Operator Intervention

cannot_connect_now the database system is starting up — 57P03

PostgreSQL error "the database system is starting up" (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

A connection attempt arrived while the server was still starting (performing crash/archive recovery before accepting normal connections). PostgreSQL refuses with SQLSTATE 57P03 (cannot_connect_now).

  • Transient — connections succeed once startup/recovery finishes.
  • Common right after a restart or crash recovery.
  • Hot standby may accept read-only connections earlier.

What the server log shows

FATAL:  the database system is starting up

Why PostgreSQL raises this — what the manual says

As Section 18.5 Shutting Down the Server explains:

A connection arrived while the postmaster was still performing startup/recovery, so it cannot yet accept queries; the server replays WAL to reach a consistent state before it begins accepting normal connections.

On startup the postmaster runs recovery to bring the cluster to a consistent state before opening for connections. Until that completes, new connections are rejected with 57P03.

Common causes

  • Connecting during normal startup right after a restart.
  • A long crash-recovery replaying lots of WAL.
  • Slow archive recovery during restore.

How to fix it

  1. Wait and retry with backoff until the server finishes recovery.
  2. Make clients/pools tolerant of 57P03 during startup windows.
  3. If recovery is slow, investigate WAL volume and I/O throughput.

Related & next steps

Reference: PostgreSQL 18 Section 19.3 “Server Start/Shutdown”.

Was this helpful?