Skip to content

Error codes

Every non-zero exit writes a JSON error envelope to stderr:

{
"code": "rate_limit",
"message": "Too many concurrent executions for this workspace",
"hint": "Rate-limited. Back off and retry; see Retry-After header if surfaced.",
"trace_id": "abc-123-def-456"
}

code is the stable, scriptable name. message is the server’s human-readable description (may include identifiers, field paths). hint is the CLI’s actionable suggestion. trace_id correlates with server-side logs.

Server-originated codes

These come from the API’s error envelope and pass through the CLI:

CodeOriginHint
unauthenticated / unauthorized401Run athena login to re-authenticate.
forbidden403Authenticated but lacking permission. Check workspace membership and role.
not_found404Check the slug or ID. Use athena agent list or athena whoami to discover valid identifiers.
conflict409Another writer changed this resource. Re-read with get <slug> and retry.
rate_limit429Rate-limited. Back off and retry; see Retry-After header if surfaced.
payment_required402Workspace credits exhausted. Top up before retrying.
validation_error / bad_request400Request body or query failed validation — see message for the offending field.
service_unavailable / external_service503 / 500 + codeAthena API is temporarily unavailable. Retry shortly.

CLI-originated codes

These the CLI generates locally without contacting the server:

CodeWhenHint
missing_inputRequired positional or flag not provided(depends on flag, e.g. “Pass it as a positional argument: athena agent get <slug>.”)
missing_api_urlNo api_url resolved from flag / env / profileSet api_url in [profile.<name>] or pass --api-url.
unauthenticatedNo token and no credentialsRun athena login or set ATHENA_API_TOKEN. (Hint adapts to your config source.)
invalid_header_valueEnv-derived header contains CRLF / non-ASCII bytesCheck the source (ATHENA_WORKSPACE_ID, --workspace, --idempotency-key) for stray newlines or invalid bytes.
invalid_workflowPre-flight workflow validation failedFix each item listed in the message body and re-run.
invalid_inputBody / query parameter parse failed locallyCheck JSON syntax of the input.
invalid_responseServer returned non-JSON body where JSON expectedLikely a server bug — file an issue with the trace_id.
stream_errorSSE chunk decode failed OR 64 KiB buffer exceededThe server may be sending malformed events. Retry; if it persists, file an issue.
stream_lostSSE closed cleanly but no terminal eventLook up the execution manually or retry with the same --idempotency-key.
networkDNS / TLS / transport failureRetry; check connectivity.
refresh_failedToken refresh round-trip failedRun athena login to re-authenticate.
configGeneric config-load failureCheck ~/.athena/config.toml syntax.
no_config_baseNo $HOME / %APPDATA% and no ATHENA_CONFIG_DIRSet $HOME (Unix), %APPDATA% (Windows), or ATHENA_CONFIG_DIR.

Pattern: branch on code not exit code

Exit codes are stable but coarse. For specific recovery paths, parse the code field on stderr:

Terminal window
out=$(athena agent run my-agent --input @./i.json 2>err.json) || {
code=$(jq -r '.code' err.json)
case "$code" in
rate_limit) sleep 30 && exec "$0" ;;
payment_required) echo "top up credits"; exit 1 ;;
invalid_workflow) echo "fix workflow:"; jq -r '.message' err.json; exit 2 ;;
*) echo "unhandled $code"; exit 1 ;;
esac
}