DocsGet startedErrors

Errors

Every error shape the API returns, and how to tell them apart.

Every error the API returns has the same JSON body — an error message and a code — and a meaningful HTTP status. Read the status for the category, code to branch on, and error for the human-readable detail. The same shape comes back from the Lambda handlers, the FastAPI worker, and the API gateway itself.

The error shape

{ "error": "Index 'idx_bp1RRYPJpNWb' not found.", "code": "not_found" }

error and code are always strings. A few fields appear when they add something more:

FieldWhenWhat it is
errorAlwaysHuman-readable message. Safe to show a user or log.
codeAlwaysA stable machine string to branch on: the status's own code (table below), or a more specific one — billing_required vs payment_failed, invalid_api_key, or the Cognito exception on a sign-in failure.
actionPlan refusalsWhat the plan does not allow, on a billing_required 402 — e.g. backtests, live, restatements, api.
issuesValidation 422sAn array of structured problems (severity, code, message, path, operation_id) when a workflow fails validation.

A sign-in failure carries a code so you can tell a wrong password from an unconfirmed account without parsing the message:

{ "error": "Incorrect username or password.", "code": "NotAuthorizedException" }

A workflow that fails validation (on POST /workflows, POST /simulate or POST /execute) returns a summary in error and the detail in issues:

{
"error": "Fix these validation issues and retry.",
"code": "validation_failed",
"issues": [
{
"severity": "error",
"code": "MISSING_INPUT_WIRING",
"message": "operation 'filter_dataframes' has no wired input",
"path": "operations[2].inputs",
"operation_id": "filter_dataframes"
}
]
}

Status codes

Status`code`MeansWhat to do
400invalid_requestMalformed request — bad JSON, missing a required fieldFix the request; do not retry it unchanged
401unauthenticated, invalid_api_keyMissing or invalid credentials — the API key, a Cognito token, sign-in or refreshCheck the key; re-authenticate. Send the token raw — a Bearer prefix also 401s
402billing_required, payment_failedThe team's plan does not include this or a plan limit is reached (action says which) — or a card was declinedUpgrade, or update the card, on the billing page, then retry
403forbiddenAuthenticated, but not allowed — not a member of the team, or the resource's owner has not shared it with youAct as a team that owns it, or ask the owner to share it
404not_foundUnknown resource id — or no such routeCheck the id and its prefix (idx_, dlv_, dst_, …), and the method and path
409conflictThe request clashes with the resource's state — it already exists, or changed since you read itRefresh, then decide whether to retry
422validation_failedWell-formed but failed validationRead issues, fix each, and retry
429rate_limitedRate limitedHonour Retry-After and back off
5xxinternal_error, upstream_error, timeoutServer, worker or upstream failureRetry with backoff; if it reproduces, the request itself is likely the cause

An unknown route is a 404

A path or method that does not exist answers 404 with {"error": "No such route. Check the method and the path.", "code": "not_found"} — usually a stray /prod in the URL or a typo. See Base URLs.

Operations run through POST /execute

A request that runs one operation answers like any other endpoint: if the operation is refused, the HTTP status says why (403, 404, 402) with the usual body. A request that runs several answers 200, and each operation reports its own outcome in state.error and state.code — one refusal does not void the rest.

Handling errors

Because there is one shape, one helper covers everything: on a non-2xx, branch on code and show error. All 4XX/5XX responses — including a gateway key rejection — carry CORS headers, so a browser fetch can read the status and body rather than failing with an opaque network error.

def error_message(response):
"""Return the error string, or None if the request succeeded."""
if response.ok:
return None
try:
return response.json().get("error") or f"HTTP {response.status_code}"
except ValueError:
return f"HTTP {response.status_code}"

Log the raw body

Keep the raw response body in your logs alongside your normalised message. On a validation failure the issues array is the whole diagnosis. A 5xx body never carries internals — it is a generic message by design.