Skip to content

Error Reference

This page covers every error code you can receive - both from the platform itself and from your handler’s runtime.


HTTP errors

These are returned by Rival’s runtime before or after your code runs.

CodeNameWhen it happensWhat to do
400Bad RequestMalformed request body - missing event field or invalid JSONVerify your request payload is valid JSON and contains an event field
401UnauthorizedMissing or invalid API key in the Authorization headerPass your key as Authorization: <key> (no Bearer prefix)
402Payment RequiredRun Balance is empty - execution blocked before runningTop Up your Run Balance or upgrade your plan
404Not FoundTool or version does not existCheck the tool ID and version on the tool’s detail page
408TimeoutYour handler exceeded its configured timeout limit (max 300s)Reduce work per call or split into smaller invocations
500Internal Server ErrorUnhandled exception thrown by your handlerInspect the run in Executions and fix the handler logic

Runtime errors (500)

When your handler throws an uncaught exception, the platform returns an HTTP 200 with a statusCode: 500 in the body:

{
"statusCode": 500,
"body": "{\"error\": \"Runtime error: <message>\"}"
}

The body field is always a JSON string - parse it to read the error message.

Python

{
"statusCode": 500,
"body": "{\"error\": \"Runtime error: division by zero\"}"
}

JavaScript

{
"statusCode": 500,
"body": "{\"error\": \"Script execution failed\", \"type\": \"ReferenceError\", \"details\": \"foo is not defined\"}"
}

Lua

{
"statusCode": 500,
"body": "{\"error\": \"Script execution failed\", \"type\": \"RuntimeError\", \"details\": \"attempt to index a nil value\"}"
}

Returning errors intentionally

Your handler can return any statusCode to signal errors to callers:

def cortexone_handler(event, context):
if not event.get("id"):
return {"statusCode": 400, "body": {"error": "id is required"}}
return {"statusCode": 200, "body": {"ok": True}}

This is the recommended pattern for validation errors - use HTTP semantics to signal the problem.


MCP error codes (JSON-RPC)

MCP tools return JSON-RPC 2.0 errors inside the response body. These are not HTTP errors - the HTTP status is always 200.

CodeNameWhen to use
-32700Parse errorRequest was not valid JSON
-32600Invalid requestjsonrpc field missing or not "2.0"
-32601Method not foundYour handler does not implement the requested method
-32602Invalid paramsArguments are missing or wrong type
-32603Internal errorUnexpected error inside your handler logic
{
"jsonrpc": "2.0",
"id": 1,
"error": {
"code": -32601,
"message": "Method not found: prompts/list"
}
}

Common mistakes

SymptomLikely causeFix
401 on every requestAPI key missing or wrong header formatPass key as Authorization: <key> - no Bearer prefix
402 on every requestRun Balance is emptyTop Up from the Run Balance card in Billing
404 on valid tool IDWrong version stringCheck the version on your tool’s detail page
500 with null bodyHandler returned None/undefined/nilAlways return {statusCode, body}
Body is a JSON string, not objectExpected behaviorParse response.body in your application