Skip to Content
APIErrors

Errors

Failed calls return an error envelope instead of result:

{ "request_id": "01J5ABCDEF1234567890ABCDEF01", "error": { "code": "VALIDATION_FAILED", "message": "input validation failed", "outcome": "not_started" } }

Branch on code and outcome. message is a fixed, safe text for people; it never contains SQL, driver errors, paths, credentials, or the values you sent. Some errors add a fixed reason, such as UPSTREAM_HTTP_STATUS. The detail behind an error is in the agent’s local log.

Codes

HTTPCodeMeaning
400INVALID_REQUESTThe request is malformed: bad JSON, bad Base64, broken multipart
400VALIDATION_FAILEDThe input does not match the capability’s schema
401AUTH_FAILEDMissing or invalid API key
403CAPABILITY_DENIEDThe API key may not call this capability
403PERMISSION_DENIEDThe source IP or browser origin is not allowed, or the agent may not access a file it needs
404NOT_FOUNDUnknown capability, no matching file, or an expired download link
409CONFLICTA database constraint was violated, a file to save already exists, or the agent was restarted with a different configuration while the call was in flight
409SOURCE_CHANGEDA file or folder changed while it was being read
413LIMIT_EXCEEDEDThe request body is larger than the gateway allows
415INVALID_REQUESTUnsupported Content-Type
422LIMIT_EXCEEDEDA capability limit was exceeded: input size, rows, output size, files
422APP_*A business error returned by a code capability
429RATE_LIMITEDA gateway, authentication, or capability rate limit was reached
500INTERNAL_ERRORAn unexpected failure
502EXECUTION_FAILEDThe database, upstream API, file operation, or code failed
502OUTPUT_INVALIDThe result did not match the declared output
502OUTCOME_UNKNOWNThe agent could not confirm whether a commit or rollback happened
503BUSYThe gateway or agent is at capacity; nothing was run
503AGENT_OFFLINENo agent is connected
503DEPENDENCY_UNAVAILABLEA database, upstream API, or required gateway setting is unavailable
504EXECUTION_TIMEOUTThe capability’s timeout or the caller’s deadline was reached

Download failures follow the same table, except that a range request gets HTTP 416. MCP tool errors carry the same codes inside a successful HTTP response; see MCP.

For RATE_LIMITED, the message tells you which limit was hit; see Troubleshooting.

Outcome

outcome says what happened on the on-prem side, independent of the code:

OutcomeMeaningWhat to do
not_startedNothing ranSafe to try again
no_changeIt ran and changed nothing, for example a failed readSafe to try again
rolled_backIt made changes, and they were all rolled backFix the cause, then try again
committedAll changes were completedDo not repeat it; the change is done
unknownChanges may or may not have happenedCheck the real state first

Trust outcome, not the code or the capability’s annotations. EXECUTION_TIMEOUT, for example, can come with not_started or unknown. Treat a call whose response you never received as unknown. Never retry an operation with unknown automatically: check the real state first, as described in Uncertain outcomes.

Application errors

A code capability can return its own business error with onprest.PublicError(code, message) in the Go SDK. The code must look like APP_CUSTOMER_NOT_FOUND: APP_, an uppercase letter, then up to 59 uppercase letters, digits, or underscores. The message is 1 to 1024 bytes of UTF-8 without control characters and is returned exactly as written, so write it for the caller. Anything else, including an invalid code, becomes EXECUTION_FAILED with a generic message.