# Error codes

Every non-2xx body. Two envelopes are live: most routes send `error`
(a sentence) with an optional `code` or `error_code`; the org-wide
session search sends `code` and `message`. Some refusals add fields
(`candidates`, `fields`, plan usage). Branch on `code` / `error_code`.

| Code | Status | Sent by |
| --- | --- | --- |
| `ACCOUNT_UNSUPPORTED` | 422 | `createSession`, `postSessionMessage` |
| `AGENT_IN_USE` | 409 | `deleteSavedAgent` |
| `ATTACHMENT_EXPIRED` | 410 | `createSession` |
| `ATTACHMENT_IN_USE` | 409 | `createSession`, `postSessionMessage` |
| `ATTACHMENT_NOT_FOUND` | 404 | `createSession` |
| `ATTACHMENT_NOT_UPLOADED` | 409 | `createSession`, `postSessionMessage` |
| `CANCELLATION_UNCONFIRMED` | 503 | `cancelSession` |
| `CATALOG_REFRESH_REQUIRED` | 409, 422 | `createSession`, `createSavedAgent` |
| `COMPUTE_LIMIT_REACHED` | 402 | `createSession` |
| `CONNECTION_AMBIGUOUS` | 422 | `createSession`, `createSavedAgent` |
| `CONNECTION_NOT_READY` | 422 | `createSession`, `createSavedAgent` |
| `CONNECTION_UNAVAILABLE` | 422 | `postSessionMessage` |
| `CONTENT_TOO_LARGE` | 400 | `postSessionMessage` |
| `CONTINUATION_UNSUPPORTED` | 409 | `postSessionMessage` |
| `CREDITS_EXHAUSTED` | 402 | `createSession` |
| `FIELD_REMOVED` | 400 | `createSession`, `postSessionMessage`, `createSavedAgent` |
| `FORBIDDEN` | 403 | `postSessionMessage`, `listSavedAgents`, `createSavedAgent`, `updateSavedAgent`, `deleteSavedAgent`, `createSecret`, `createAutomation`, `updateAutomation`, `deleteAutomation`, `createAutomationTrigger`, `updateAutomationTrigger`, `deleteAutomationTrigger`, `rotateAutomationTriggerSecret` |
| `FREE_TRIAL_USED` | 402 | `createSession` |
| `GMAIL_NOT_CONNECTED` | 422 | `createAutomation`, `updateAutomation`, `createAutomationTrigger` |
| `HANDLE_TAKEN` | 409 | `createSavedAgent` |
| `IDEMPOTENCY_CONFLICT` | 409 | `createSession` |
| `IF_MATCH_REQUIRED` | 428 | `updateSavedAgent`, `deleteSavedAgent` |
| `IMMUTABLE_FIELD` | 422 | `updateSavedAgent` |
| `INPUT_FETCH_FAILED` | 422 | `createSession`, `postSessionMessage` |
| `INSTALLATION_NOT_LINKED` | 403 | `createSession` |
| `INVALID_BODY` | 400, 422 | `createSession`, `postSessionMessage`, `createSavedAgent`, `getSavedAgent`, `listAgentConnections`, `createAgentConnection`, `createSecret`, `updateSecret`, `createFiles` |
| `INVALID_CATALOG` | 422 | `createSavedAgent` |
| `INVALID_DESCRIPTION` | 422 | `createSavedAgent` |
| `INVALID_EFFORT` | 422 | `createSavedAgent` |
| `INVALID_FILTER` | 400 | `getSessionMessages` |
| `INVALID_HANDLE` | 422 | `createSavedAgent` |
| `INVALID_HARNESS` | 422 | `createSavedAgent` |
| `INVALID_INSTRUCTIONS` | 422 | `createSavedAgent` |
| `INVALID_MODEL` | 422 | `createSavedAgent` |
| `INVALID_NAME` | 422 | `createSavedAgent` |
| `INVALID_REVISION` | 400 | `getSavedAgent` |
| `INVALID_SCHEDULE` | 422 | `createAutomation`, `updateAutomation`, `createAutomationTrigger`, `updateAutomationTrigger` |
| `LINEAR_NOT_CONNECTED` | 422 | `createAutomation`, `updateAutomation`, `createAutomationTrigger` |
| `MCP_SERVER_URL_INVALID` | 422 | `createSession` |
| `MODEL_ACCOUNT_MISSING` | 402 | `createSession` |
| `MODEL_UNSUPPORTED` | 422 | `createSession`, `createAutomation`, `updateAutomation` |
| `NOT_FOUND` | 404 | `getSessionMessages`, `getSavedAgent`, `updateSavedAgent`, `deleteSavedAgent`, `listAgentConnections`, `createAgentConnection`, `getAgentConnection`, `deleteAgentConnection`, `removeDevice`, `getPublicCommunityAgent`, `getPublicCommunityProject` |
| `PAYMENT_METHOD_REQUIRED` | 402 | `createSession` |
| `PERSISTENCE_MODE_CONFLICT` | 409 | `postSessionMessage`, `createAutomation`, `updateAutomation` |
| `PLAN_REQUIRED` | 402 | `createSession` |
| `PROJECT_HAS_NO_REPOSITORY` | 422 | `updateAutomation` |
| `PROJECT_PAUSED` | 409 | `postSessionMessage` |
| `RATE_LIMITED` | 429 | `listProjects`, `createProject`, `getProject`, `listSessions`, `createSession`, `getSession`, `cancelSession`, `streamSession`, `getSessionMessages`, `postSessionMessage`, `getSessionArtifact`, `getSessionAttachment`, `createProjectSession`, `getSessionChanges`, `listSessionArtifacts`, `listTurns`, `getTurn`, `listApiKeys`, `createApiKey`, `updateApiKeyWebhook`, `revokeApiKey`, `rotateApiKey`, `getAgentsAvailable`, `getOrgBilling`, `listSavedAgents`, `createSavedAgent`, `getSavedAgent`, `updateSavedAgent`, `deleteSavedAgent`, `listAgentConnections`, `createAgentConnection`, `getAgentConnection`, `deleteAgentConnection`, `listSecrets`, `createSecret`, `updateSecret`, `deleteSecret`, `getGithubConnection`, `listOrgAutomations`, `listAutomations`, `createAutomation`, `getAutomation`, `updateAutomation`, `deleteAutomation`, `createAutomationTrigger`, `updateAutomationTrigger`, `deleteAutomationTrigger`, `rotateAutomationTriggerSecret`, `removeDevice`, `listDevices`, `getPublicCommunityAgent`, `listPublicCommunityAgents`, `getPublicCommunityProject`, `listPublicCommunityProjects` |
| `REPO_NOT_IN_INSTALLATION` | 403 | `createSession` |
| `REQUEST_TOO_LARGE` | 413 | `createSession`, `postSessionMessage` |
| `RESOURCE_NOT_ACCESSIBLE` | 422 | `createSession` |
| `RESOURCE_UNSUPPORTED` | 422 | `createSession` |
| `RUN_STATE_CONFLICT` | 409 | `cancelSession` |
| `RUNTIME_UNPINNABLE` | 422 | `createSession` |
| `SECRET_CHANGED` | 409 | `updateSecret` |
| `SECRET_DESCRIPTION_INVALID` | 422 | `createSecret`, `updateSecret` |
| `SECRET_FIELD_IMMUTABLE` | 422 | `createSecret`, `updateSecret` |
| `SECRET_KIND_INVALID` | 422 | `createSecret` |
| `SECRET_NAME_INVALID` | 422 | `createSecret` |
| `SECRET_NAME_TAKEN` | 409 | `createSecret` |
| `SECRET_NOT_FOUND` | 404 | `createSecret`, `updateSecret`, `deleteSecret` |
| `SECRET_ONEPASSWORD_NOT_CONNECTED` | 422 | `createSecret` |
| `SECRET_ONEPASSWORD_NOT_FOUND` | 422 | `createSecret` |
| `SECRET_ONEPASSWORD_RATE_LIMITED` | 422 | `createSecret` |
| `SECRET_ONEPASSWORD_TOKEN_REJECTED` | 422 | `createSecret` |
| `SECRET_ONEPASSWORD_UNAVAILABLE` | 422 | `createSecret` |
| `SECRET_PROJECT_NOT_IN_ORG` | 422 | `createSecret` |
| `SECRET_PROJECT_REQUIRED` | 422 | `createSecret` |
| `SECRET_SOURCE_INVALID` | 422 | `createSecret` |
| `SECRET_TARGET_INVALID` | 422 | `createSecret` |
| `SECRET_VALUE_INVALID` | 422 | `createSecret`, `updateSecret` |
| `SESSION_NOT_CAPTURED` | 404 | `getSessionMessages` |
| `SKILL_FETCH_FAILED` | 422 | `createSession`, `createSavedAgent` |
| `SKILL_INVALID` | 422 | `createSession`, `createSavedAgent` |
| `SKILL_TOOL_REQUIRED` | 422 | `updateSavedAgent` |
| `SPEED_NOT_QUALIFIED` | 422 | `createSession` |
| `SPEND_CAP_REACHED` | 402 | `createSession` |
| `STALE_ETAG` | 412 | `updateSavedAgent`, `deleteSavedAgent` |
| `TASK_TERMINAL` | 409 | `postSessionMessage`, `createAutomation`, `updateAutomation` |
| `TEMPLATE_AGENT_UNLISTED` | 422 | `createProject` |
| `TEMPLATE_FIELDS` | 422 | `createSavedAgent`, `updateSavedAgent` |
| `TEMPLATE_IN_USE` | 409 | `deleteSavedAgent` |
| `TEMPLATE_NEEDS_CONNECTION` | 422 | `createProject` |
| `TOKEN_LIMIT_REACHED` | 402 | `createSession` |
| `TOO_MANY_FILES` | 400 | `createFiles` |
| `UNKNOWN_FIELD` | 400 | `createSession`, `createSavedAgent`, `createAgentConnection` |
| `UNSUPPORTED_AGENT` | 422 | `createSession` |
| `UNSUPPORTED_PROFILE` | 422 | `createSession`, `createSavedAgent`, `updateSavedAgent` |
| `VALIDATION_ERROR` | 400 | `createApiKey`, `updateApiKeyWebhook`, `getAgentsAvailable`, `deleteAutomationTrigger`, `listPublicCommunityAgents`, `listPublicCommunityProjects` |
| `WEEKLY_COMPUTE_LIMIT_REACHED` | 402 | `createSession` |
