57P03
Read PG 18 manual ↗cannot_connect_now
- SQLSTATE
- 57P03
- Condition name
- cannot_connect_now
- Class
- Operator Intervention
- Source macro
- ERRCODE_CANNOT_CONNECT_NOW
- Evidence
- Source path confirmed
English SQLSTATE atlas: authored explanations and source/runtime evidence are separate from the manual definitions. View source ↗
At a glance
57P03 is emitted during connection startup when the database has not reached a connection-ready state. Fixed guards distinguish startup, shutdown, recovery, disabled hot standby, and two different not-yet-consistent recovery states.
Meaning
The startup packet is rejected before normal authentication is completed. Every fixed branch uses FATAL, so the attempted connection ends rather than entering a client transaction. The primary alone is not enough for the hot-standby branches: detail distinguishes a disabled feature, a recovery snapshot that is not ready, and recovery that has not reached a consistent state.
Messages
- Startup gate: primary
the database system is starting up, FATAL. - Hot standby disabled: primary
the database system is not accepting connections, FATAL; detailHot standby mode is disabled. - Recovery snapshot not ready: primary
the database system is not yet accepting connections, FATAL; detailRecovery snapshot is not yet ready for hot standby.; hintTo enable hot standby, close write transactions with more than %d subtransactions on the primary server. - Recovery not consistent: primary
the database system is not yet accepting connections, FATAL; detailConsistent recovery state has not been yet reached. - Shutdown gate: primary
the database system is shutting down, FATAL. - Recovery gate: primary
the database system is in recovery mode, FATAL.
Diagnosis
Capture primary/detail/hint, the startup phase, hot-standby setting, recovery consistency/snapshot state, server readiness log, and target server role. A repeated not yet accepting response with the snapshot detail points to the primary-side subtransaction condition named by the hint; the consistent-recovery detail points to an earlier recovery gate. Do not treat these as a transaction stuck in INERROR: the connection was refused before a session transaction existed.
Response
Use bounded backoff and wait for the relevant startup, shutdown, or recovery transition. If hot standby is intentionally disabled, remember that hot_standby is a PGC_POSTMASTER setting: change the configuration source owned by the server and restart the server; a SIGHUP/reload cannot activate this setting. If the hint identifies long primary write transactions, resolve that operational cause. Establish a new connection after readiness. There is no transaction on the rejected startup path to roll back; if a prior client operation was disconnected during a transition, verify its business result before replaying it.
Versions
The locked catalogue records this condition from 7.4; that boundary does not prove the exact implementation-introduction version. Fixed source coverage is PostgreSQL 18.6.
Sources
src/backend/tcop/backend_startup.c#L298-338
src/backend/utils/misc/guc_tables.c#L1895-1903
The structured evidence record records all fixed startup gates and the source/runtime boundary.
Source evidence
Evidence belongs to the frozen source and runtime versions listed here. It is not a runtime verification of the selected manual version.
The fixed startup guards support all listed startup/recovery messages, and guc_tables.c defines hot_standby as PGC_POSTMASTER, so enabling it requires a server restart rather than a reload.
Method: Read the complete startup guard and hot_standby GUC definition.
Limits: Source confirmation is not natural runtime.
The locked catalogue records 57P03 from 7.4; that boundary does not prove exact implementation introduction.
Method: Use catalogue boundary.
hot_standby has GUC context PGC_POSTMASTER; a SIGHUP/reload cannot activate a changed value for the running server.
Method: Read the fixed guc_tables.c entry.
- src/backend/utils/errcodes.txt · REL_18_6 ·
724edf9bde9d356724ad384a2e196edc3c9f80f7 - src/backend/tcop/backend_startup.c · REL_18_6 ·
724edf9bde9d356724ad384a2e196edc3c9f80f7 - src/backend/utils/misc/guc_tables.c · REL_18_6 ·
724edf9bde9d356724ad384a2e196edc3c9f80f7
Message templates
FATAL · message.0
Primary
the database system is starting up
FATAL · message.1
Primary
the database system is not accepting connections
Detail
Hot standby mode is disabled.
FATAL · message.2
Primary
the database system is not yet accepting connections
Detail
Recovery snapshot is not yet ready for hot standby.
Hint
To enable hot standby, close write transactions with more than %d subtransactions on the primary server.
FATAL · message.3
Primary
the database system is not yet accepting connections
Detail
Consistent recovery state has not been yet reached.
FATAL · message.4
Primary
the database system is shutting down
FATAL · message.5
Primary
the database system is in recovery mode
Reproduction & repair cases
No reproduction case is attached to this condition.
Recorded runtime evidence
No runtime observation is attached to this entry.
Definition snapshot: english-manuals:a816cb8c72490535b043f39d318… · English manual source