PostgreSQL 57P03: cannot connect now
The server is up but not accepting connections yet: still starting, recovering after a crash, or shutting down. Wait and retry.
- SQLSTATE
57P03- Name
cannot_connect_now- Category
- Operator Intervention
What it means
57P03 (cannot_connect_now) is returned at login while the server is in a state where it can't serve sessions. The message says which: the database system is starting up, the database system is in recovery mode (replaying WAL after a crash), the database system is shutting down, or the database system is not yet accepting connections on a standby that hasn't reached a consistent state.
It is temporary. After a crash, recovery time depends on how much WAL has to be replayed since the last checkpoint.
Common causes
- The server was just started or restarted.
- A backend crashed, and the server is restarting all sessions and running crash recovery.
- A standby is still catching up, or
hot_standbyis off so it never accepts read-only connections. - The server is shutting down.
How to fix it
-
Wait a moment and reconnect; have clients retry with a backoff.
-
If it keeps happening, read the server log for the reason the server restarted, such as a crash or an out-of-memory kill.
-
On a standby that should accept reads, make sure
hot_standby = on(the default) and wait for it to reach a consistent recovery state.
Related errors
57P01terminating connection due to administrator08001unable to establish connection53300too many connectionsORA-01034Oracle: ORACLE not available
More operator intervention errors
The code and message text are from the PostgreSQL documentation, Appendix A: PostgreSQL Error Codes. Browse the full PostgreSQL error list or search every database error.
Work on PostgreSQL in SQLly
A native SQL client for macOS, Windows and Linux with schema-aware IntelliSense, guardrails for risky statements and clear error messages, for PostgreSQL and the other databases you use.