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 the execution gateway before or after your code runs.

CodeNameCause
400Bad RequestMalformed request body — missing event field or invalid JSON
401UnauthorizedMissing or invalid API key in the Authorization header
402Payment RequiredInsufficient wallet balance — execution blocked before running
404Not FoundFunction ID or version does not exist
408TimeoutYour handler exceeded its configured timeout limit
500Internal Server ErrorUnhandled exception thrown by your handler

Runtime errors (500)

When your handler throws an uncaught exception, the platform returns 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 requestWallet balance is zeroTop up from Settings → Billing
404 on valid function 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