> For the complete documentation index, see [llms.txt](https://krynix.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://krynix.gitbook.io/docs/reference/error-codes.md). Agents can also search and read this documentation through its [MCP server](https://krynix.gitbook.io/docs/~gitbook/mcp).

# Error codes

Every error from Krynix is `{ "error": { "code": "…", "message": "…" } }`. The dashboard shows the message as Krynix wrote it. The codes you are most likely to meet:

## Authentication and authorisation

| Status | Code                     | Meaning                                                                                                                                                                                                        |
| ------ | ------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 401    | `AUTH_REQUIRED`          | No key, or a revoked or unknown one. No detail is given about which.                                                                                                                                           |
| 403    | `AUTH_FORBIDDEN`         | The action needs a signed-in person, not an API key, or the account is not a member of an organisation.                                                                                                        |
| 403    | `KEY_SCOPE_INSUFFICIENT` | An API key used for anything but sending records and asking for decisions.                                                                                                                                     |
| 403    | governance refusal       | A change to controls, policies, agents, retention or legal hold by an API key or a member. The message says which: "Ingest API keys cannot change controls or policies" or "Requires the owner or admin role". |
| 429    | `RATE_LIMITED`           | Over the per-key budget; `Retry-After` says when to retry.                                                                                                                                                     |

## Sessions and evidence

| Status | Code                           | Meaning                                                                                                                                                                             |
| ------ | ------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 404    | `SESSION_NOT_FOUND`            | No such session in your organisation.                                                                                                                                               |
| 410    | `SESSION_DELETED`              | Retention destroyed it; the message carries the date, and the session's page shows the tombstone.                                                                                   |
| 410    | `SESSION_EVIDENCE_UNAVAILABLE` | A real session whose records cannot be served. Not a deletion: no tombstone exists and the cause is not recorded. Its chain tip is still reported by `GET /v1/sessions/:id/status`. |
| 409    | `SESSION_CLOSED`               | Records for a session that was uploaded whole and has no recorded ending. (A session Krynix or its client closed takes records into a continuation instead.)                        |
| 404    | `TOMBSTONE_NOT_FOUND`          | That session was never swept.                                                                                                                                                       |
| 400    | `UNKNOWN_QUERY_PARAM`          | A filter the endpoint does not take. Refused rather than ignored, so a narrowed question is never answered over the whole dataset; the message lists what is accepted.              |
| 400    | `INVALID_QUERY_PARAM`          | A malformed value: a bad timestamp, a backwards window.                                                                                                                             |
| 413    |                                | The body is over 10 MiB.                                                                                                                                                            |
| 415    |                                | `Content-Type` is not `application/json`.                                                                                                                                           |

## Decisions

| Status | Code                                                                                      | Meaning                                                                                                   |
| ------ | ----------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- |
| 422    | `POLICY_UNBOUND`                                                                          | The agent has no policy bound and no baseline covers it. Nothing was evaluated, so nothing is authorised. |
| 422    | `POLICY_NOT_REGISTERED`, `POLICY_ARCHIVED`, `POLICY_UNPARSEABLE`, `POLICY_NOT_APPLICABLE` | The policy named cannot decide: unknown, archived, unparseable, or its scope does not cover the agent.    |
| 503    | `EVIDENCE_UNAVAILABLE`                                                                    | The decision could not be recorded, so no verdict was returned.                                           |

## Agents, policies, controls

| Status | Code                       | Meaning                                                                                                                                         |
| ------ | -------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| 404    | `AGENT_NOT_FOUND`          | Not registered, or archived.                                                                                                                    |
| 409    | `AGENT_ALREADY_REGISTERED` | A live registration with that id exists.                                                                                                        |
| 422    | `AGENT_ID_NOT_INSTALLABLE` | The id holds a character that cannot travel in an environment variable (space, `,`, `=`, `%`, non-ASCII), or, for Codex, a shell metacharacter. |
| 400    | `INVALID_INSTALL_OPTIONS`  | A required install choice is missing or invalid; the message names it.                                                                          |
| 409    | `POLICY_VERSION_EXISTS`    | A different text under an existing version.                                                                                                     |
| 409    | `POLICY_VERSION_ARCHIVED`  | That version id was archived and is never reused.                                                                                               |
| 409    | `POLICY_IN_USE`            | The version is bound to a live agent or is a baseline.                                                                                          |
| 409    | `POLICY_VERSION_CONFLICT`  | A baseline names a policy some live agent is bound to at another version, or the reverse.                                                       |
| 409    | `CONTROL_NAME_TAKEN`       | A live control already has that name.                                                                                                           |
| 400    | `INVALID_CONTROL_ID`       | Not a UUID.                                                                                                                                     |
| 404    | `CONTROL_NOT_FOUND`        | Unknown or archived (status and trail stay readable).                                                                                           |

## Organisation

| Status | Code                                       | Meaning                                                                             |
| ------ | ------------------------------------------ | ----------------------------------------------------------------------------------- |
| 409    | `LAST_OWNER`                               | "Cannot remove the last owner of the organization."                                 |
| 409    | `INVITATION_EXISTS`, `INVITATION_NOT_OPEN` | The person already has an open invitation; or the invitation was used or withdrawn. |
| 410    | `INVITATION_EXPIRED`                       | Ask for a new one.                                                                  |
| 409    | `ORG_EXISTS`                               | That short name is taken; the invitation stays open for another try.                |
| 404    | `API_KEY_NOT_FOUND`                        | Unknown id, or another organisation's key.                                          |
