Skip to content

Error handling

Errors surface in two places: the HTTP status of the response, and — when a task runs but does not succeed — a structured failure_code on the task body. This page is the central reference; per-endpoint status codes are listed in the API reference.

StatusMeaningTypical cause
200Request handledThe task ran; check status / failure_code in the body for the outcome
400Bad requestUnknown model, or no adapter available for the requested provider
422Validation errorMalformed body — empty prompt, prompt too long, conflicting options
501Not implementedA requested capability is not wired up for the selected path
503Service unavailableStorage is down, or the browser profile is not authenticated
504Gateway timeoutExecution exceeded GRACEKELLY_ORCHESTRATE_TIMEOUT_SECONDS

A 422 uses FastAPI’s standard envelope: a detail array where each entry locates the offending field (loc), a human message (msg), and an error type.

{
"detail": [
{
"loc": ["body", "prompt"],
"msg": "String should have at least 1 character",
"type": "string_too_short"
}
]
}

When a task’s status is failed, failure_code carries one of the values below (from FailureCode in src/gracekelly/core/contracts.py). Recovery steps live in the operator runbook.

failure_codeWhat it meansWhere to look
auth_failedThe browser profile is not logged in to Perplexity, or an API key is rejectedRe-run the profile bootstrap — see onboarding
model_mismatchThe requested model is not available on the adapter that resolved itCheck the model catalog and your model / models
provider_unavailableThe adapter is unreachable or its circuit breaker is openBrowser triage and circuit-breaker recovery in the runbook
timeoutExecution exceeded its budget (cold-start navigation or the orchestrate timeout)Raise GRACEKELLY_ORCHESTRATE_TIMEOUT_SECONDS or retry once warm
rate_limitedThe rate limiter rejected the requestBack off, or review GRACEKELLY_REDIS_URL / token-bucket limits
storage_failedThe task or run store returned an errorStorage validation section of the runbook
unknown_errorAn uncategorised failureInspect the task events via GET /api/v1/tasks/{task_id}