Skip to Content
APIErrors

Errors

Onprest returns stable error codes with public client-facing messages, and keeps sensitive detail out of external responses.

HTTP Boundary Errors

HTTPCodeMeaning
401GATEWAY_AUTH_FAILEDAPI key is missing or invalid
403GATEWAY_CAPABILITY_DENIEDAPI key cannot call the capability
403GATEWAY_IP_DENIEDSource IP is not allowed
429GATEWAY_RATE_LIMITEDRate limit exceeded
500GATEWAY_INTERNAL_ERRORUnexpected gateway error
503GATEWAY_AGENT_OFFLINEAgent is not connected
503AGENT_BUSYAgent execution slots and bounded waiting queue are full
504GATEWAY_TIMEOUTAgent response timed out
400AGENT_VALIDATION_FAILEDAgent rejected params (REST)
502AGENT_QUERY_FAILEDSQL execution failed
504AGENT_QUERY_TIMEOUTQuery exceeded timeout (REST)
502AGENT_DB_UNREACHABLEAgent cannot reach the DB
502AGENT_INTERNAL_ERRORUnexpected agent error

The agent-originated rows above are REST mappings. MCP tools/call returns those runtime failures as HTTP 200 tool results with isError: true. Gateway boundary errors use the HTTP status shown above.

Endpoint HTTP Errors

HTTPCodeApplies toMeaning
400GATEWAY_INVALID_REQUESTRESTJSON parse failure or invalid content type
404GATEWAY_CAPABILITY_NOT_FOUNDRESTcapability path does not exist
405GATEWAY_METHOD_NOT_ALLOWEDREST / MCPHTTP method is not allowed
409GATEWAY_AGENT_ALREADY_CONNECTEDWebSocketanother agent is already connected

MCP JSON-RPC Errors

These are returned as JSON-RPC errors with HTTP 200.

JSON-RPC codeCodeMeaning
-32700PARSE_ERRORJSON cannot be parsed
-32600INVALID_REQUESTInvalid JSON-RPC shape
-32601METHOD_NOT_FOUNDUnsupported method
-32602INVALID_PARAMSInvalid tools/call name or arguments
-32000GATEWAY_AGENT_OFFLINEtools/list metadata is unavailable

Known-tool execution failures are not JSON-RPC errors. They are MCP results whose isError is true, with the stable agent code/message under structuredContent.error and one text content item. A valid notification has no id and returns HTTP 202 with an empty body.

Public Error Body

REST and HTTP-level MCP errors include error.code and public error.message.

{ "error": { "code": "AGENT_QUERY_FAILED", "message": "database query failed" } }

message is part of the public API contract. Agent validation messages may identify the invalid field and reason so callers can fix their request. Clients should still branch on code.

Agent-originated raw detail such as stack traces, SQL text, DB-specific error text, DB credentials, and submitted param values is written only to onprest-agent.log when needed. It is not sent to gateway and is not included in gateway stdout or HTTP responses.

Agent-Originated Messages

For agent errors, gateway returns the agent’s public code and message unchanged. Secret detail stays in the agent local log.

CodePublic message
GATEWAY_CAPABILITY_NOT_FOUNDcapability is not defined
AGENT_VALIDATION_FAILEDone of the validation messages below
AGENT_QUERY_FAILEDdatabase query failed or response exceeds policy.max_bytes
AGENT_QUERY_TIMEOUTquery exceeded policy.timeout
AGENT_DB_UNREACHABLEdatabase is unreachable
AGENT_INTERNAL_ERRORagent internal error
AGENT_BUSYagent request queue is full

Validation messages use the parameter name but never the submitted value.

ConditionPublic message
unknown parameterunknown param: {name}
missing required parameterrequired param missing: {name}
string type mismatch{name}: must be string
string pattern mismatch{name}: does not match pattern
string too short{name}: below minLength
string too long{name}: above maxLength
invalid email{name}: must be email
invalid UUID{name}: must be uuid
invalid date{name}: must be date
invalid date-time{name}: must be date-time
invalid URI{name}: must be uri
URI without scheme{name}: must include URI scheme
integer type mismatch{name}: must be integer
integer below minimum{name}: below minimum
integer above maximum{name}: above maximum
number type mismatch{name}: must be number
number below minimum{name}: below minimum
number above maximum{name}: above maximum
boolean type mismatch{name}: must be boolean
enum mismatch{name}: not in enum