SQLSTATE Mapping

NodeDB maps internal error codes to PostgreSQL SQLSTATE codes for pgwire compatibility.

NodeDB ErrorSQLSTATEPostgreSQL Meaning
Syntax error42601Syntax error
Collection not found42P01Undefined table
Column not found42703Undefined column
Type mismatch42846Cannot coerce
Column outside GROUP BY and aggregates42803Grouping error
Unique violation23505Unique violation
FK violation23503Foreign key violation
Check violation23514Check violation
Not null violation23502Not null violation
Permission denied42501Insufficient privilege
Numeric overflow22003Numeric value out of range
Division by zero22012Division by zero
Rate limit exceeded53300Too many connections
Tenant quota exceeded53400Configuration limit exceeded
Database quota exceeded53400Configuration limit exceeded
Server overload (SERVER_OVERLOAD, dispatch capacity)57P03Cannot connect now
Quota overcommit53400Configuration limit exceeded
Database not found3D000Invalid catalog name (HTTP 404)
Mirror read only25006Read-only SQL transaction
Stale read on mirror55P03Lock not available (redirect to source)
Clone depth exceeded54011Program limit exceeded (class 54)
Session not found42704Undefined object
Session idle timeout42601Syntax error (BAD_REQUEST)
Session closed: user dropped or KILL SESSION42601Syntax error (BAD_REQUEST)
Internal errorXX000Internal error

Errors reported at Parse

A planning error reaches a driver at Parse (prepare) with its SQLSTATE when the statement has no $N placeholders. Class 42 errors and 0A000 report at Parse. These errors defer to Execute: 42501 (insufficient privilege), data errors of class 22, and retryable errors of class 40.

With placeholders, Parse plans each $N as NULL. It reports only these errors: 42P01 (unknown table), 42703 (unknown column), 42702 (ambiguous column), 42883 (unknown function), and 42803 (column outside GROUP BY). Every other error defers to Execute, which plans with the bound values.

Retryable capacity refusal (57P03)

57P03 is a transient refusal. Its usual cause is a Data Plane dispatch queue at capacity: the server enqueued nothing and ran nothing. A collection that is draining and a migration in progress answer 57P03 too. Retry the same statement with backoff. nodedb_server_overload_responses_total{protocol} counts each 57P03 answer sent. See Error Codes for the full contract.

View page sourceLast updated on Oct 18, 2026 by Farhan Syah