Error Codes

2 min read

Error Codes

PgArachne returns standard JSON-RPC 2.0 error objects. Below are the specific codes you may encounter:

CodeMessageMeaning
-32700Parse errorInvalid JSON was received by the server.
-32601Method not foundThe function does not exist in the schema.
-32602Invalid paramsArguments do not match the function signature.
-32001Permission deniedThe current user role lacks privileges to execute the function (DB level).
-32000Internal ErrorGeneric server error (check logs).
Current behavior: runtime responses are primarily mapped to HTTP status codes with a JSON-RPC error message. Custom JSON-RPC code -32001 is used for role/permission denial.

HTTP Status Mapping

HTTPTypical messageWhen it happens
400Invalid JSON request/Invalid function nameMalformed request payload or method format.
401Authorization header is missing/Invalid or expired tokenMissing or invalid auth.
403Permission denied for the specified roleSET LOCAL ROLE failed (-32001).
404Function does not exist/JWT is disabled/get_jwt was removedTarget method is missing (-32601), /token was called while JWT_SECRET is not configured, or the removed JSON-RPC method get_jwt was called (use POST /{prefix}/{database}/token).
429Too many login attempts/Too many failed authentication attemptsLogin or authentication rate limit exceeded (LOGIN_RATE_LIMIT, LOGIN_RATE_LIMIT_PER_IP).
413Request body too large/Response too large/Too many files in responseRequest exceeds MAX_REQUEST_BYTES, or a /file response exceeds FILE_MAX_BYTES / FILE_MAX_ENTRIES.
500Function call failed/Transaction commit failedExecution or commit failed.
503Database connection failed/Database unavailableDatabase or listener temporarily unavailable.