---
title: Kovlet errors and limits reference
overline: REFERENCE
kind: reference
nav: Errors and limits
updated: 2026-12
reviewed: 2026-12
minutes: 12
next: protocol
---

# Kovlet errors and limits reference

For looking up an error code or a limit while you build or debug. Each error comes with its HTTP status or WebSocket close code, what it means and what to do next.

> **At a glance**
>
> - Every error has a stable snake_case `code`, a `message` and a `hint` that names the next step. Branch on `code`, show `hint`, never parse `message`.
> - REST errors come with an HTTP status. Sync errors are `error` frames or per-mutation rejections in an `ack`.
> - Retry only `internal`, `rate_limited`, `not_ready`, `shutting_down` and `concurrent_*` codes, with backoff. Everything else needs a change first.
> - Plan limits stop growth only (`quota_exceeded`). Reads, edits, deletes, exports and restores keep working.
> - The Free plan includes 3 Data Spaces, 100,000 rows and 1 GiB of files. [Plan quotas](#plan-quotas) has every limit.

The first half covers every error code from the sync WebSocket, REST and the MCP server. The second half lists every limit: protocol limits, request and sign-in limits, and the plan quotas (`DefaultQuotas()` in kovletd), including monthly active end users and the daily sign-in email cap.

This page is checked against the server source on every build (`internal/protocol/errors.go`, `internal/policy/quota.go` and `docs/openapi.yaml`), so a code or a limit can't change without it. For the frame-level detail of the sync protocol, see the [sync protocol reference](/docs/protocol).

## Error shapes

### REST

Every REST error has the same envelope. Extra machine-readable fields (`details`) sit next to `code`:

```json
{
  "error": {
    "code": "quota_exceeded",
    "message": "Your plan includes 3 Data Spaces. Delete one or request an upgrade to create more.",
    "hint": "The spaces limit (3) is reached; only growth is paused. ...",
    "metric": "spaces", "used": 3, "limit": 3, "upgrade_url": "/upgrade", "reads_open": true
  }
}
```

The OAuth endpoints (`/v1/oauth/*`) use the OAuth error shape instead, with the code in `error` and an optional `reason`:

```json
{ "error": "authorization_pending", "error_description": "waiting for the user to approve at /activate" }
```

`"reason": "device_revoked"` (with `invalid_grant` or `access_denied`) means the device key's machine was revoked: delete that key, generate a new one and sign in again.

The OpenAPI spec at [/openapi.json](/openapi.json) lists the codes each route can return in `x-kovlet-error-codes` on each response.

### Sync WebSocket

- **Session errors** arrive as an `error` frame, `{"type": "error", "code", "message", "hint", "details"?}`. A fatal one is followed by a close with the code's close code (table below).
- **Mutation rejections** arrive in the `ack`: each rejected mutation has `status: "rejected"` and an `error` object with `code`, `message`, `hint` and `details`. The rest of the frame still applies (unless it was an atomic batch).
- **Protocol 2 subscription errors** are `error` frames with `sub`. They end that subscription only.

### MCP tools and SDKs

- An MCP tool that fails returns a normal tool result with `isError: true` and a JSON body `{"error", "code", "message", "hint", ...details}` (`error` and `code` hold the same value).
- `@kovlet/client` throws or reports a `KovletError` with `code`, `message`, `hint` and `details`; the same codes as below. The native SDKs carry the same fields.

### Handling rules for every client

1. Branch on `code`. Treat an unknown code like `internal` (session errors, REST 5xx) or like `invalid_mutation` (a rejected mutation), and don't crash: servers may add codes.
2. Show or log `hint`. It names the exact fix, often with the table, column or URL involved.
3. Retry only the retryable codes, with exponential backoff and jitter, and honour `Retry-After` / `retry_after` when present.
4. Never retry a `quota_exceeded` write in a loop. Free up room or send the user to `upgrade_url`.

## Sync protocol error codes

These are the `ErrorCode` values of the sync protocol. "Close" is the WebSocket close code sent after a fatal error frame (4000 + the closest HTTP status). Codes that never end a session still have one, so that a client can map any 44xx close.

| Code | Close | Sent as | Meaning | What to do |
| --- | --- | --- | --- | --- |
| `invalid_frame` | 4400 | session error, fatal | Malformed JSON, unknown frame `type`, no `hello` within 10 s, a `mutate` with no or more than 500 mutations. Over REST: a body that isn't valid JSON for the route (HTTP 400). | Client bug. Fix the frame; don't reconnect in a tight loop. |
| `unauthenticated` | 4401 | session error, fatal | Missing, expired or revoked token, or a bad device proof. REST: HTTP 401. | Refresh a device-bound session, or sign in again. |
| `forbidden` | 4403 | session error, fatal at `hello`; whole-frame rejection in an `ack` | No access. `details.reason` says why: `no_app_grant`, `no_machine_grant`, `no_user_grant`, `app_not_approved`, `machine_not_approved`, `app_revoked`, `machine_revoked`, `origin_mismatch`, `insufficient_role`. | Stop syncing the space and show `hint`. Retry only after access changes. |
| `space_not_found` | 4404 | session error, fatal | The space doesn't exist or isn't visible to this session. REST: HTTP 404. | List the reachable spaces and use one of their ids. |
| `unsupported_protocol` | 4426 | session error, fatal | `hello.protocol` isn't spoken by the server; `details.supported` lists the versions. | Reconnect once with the highest common version, or upgrade the SDK. |
| `schema_proposal_required` | 4409 | session error, not fatal | The declared schema has a destructive change; it waits for an owner's approval (`details.proposal_id`). | Tell the developer. Make the column optional to apply it at once. |
| `schema_violation` | 4422 | mutation rejection | The write doesn't match the table schema. `details.reason`: `unknown_table`, `unknown_column`, `type_mismatch`, `required_missing`, `null_not_allowed`, `row_too_large`. | Drop it and fix the write, or add the column first. |
| `clock_drift` | 4422 | mutation rejection | The HLC is more than 5 minutes ahead of server time. | Fix the clock, re-stamp the mutation and resend it. |
| `path_conflict` | 4409 | mutation rejection; REST HTTP 409 | Another live file holds the path (`details.path`, `details.file_id`). | Pick another path, or update that file. |
| `blob_missing` | 4422 | mutation rejection | A file `put` before its bytes were uploaded (`details.sha256`). | Upload the bytes, then resend. `space.files.upload()` does both. |
| `quota_exceeded` | 4402 | mutation rejection; REST HTTP 402 | A plan limit or a per-space cap is reached. `details`: `metric`, `used`, `limit` (the hard stop), `soft_limit` (rows), `upgrade_url`, `reads_open`, `scope` (`"space"` for a partner's per-space cap). | Drop the write or keep it queued. Show `upgrade_url`. See [Plan quotas](#plan-quotas). |
| `not_found` | 4404 | mutation rejection; REST HTTP 404 | A change to a row or file the space doesn't have (`details.id`, `details.table`, `details.reason`). | Send the row's upsert (or the file's put) first. |
| `invalid_id` | 4422 | mutation rejection; REST HTTP 400 | The record or file id breaks the id rule, or a file put reuses a file id that is already taken (file ids are unique across all spaces). | Fix the id: record ids are 1–256 bytes of UTF-8 without control characters; file ids are 1–128 of `[A-Za-z0-9_-]`. For a taken file id, generate a fresh one. |
| `invalid_mutation` | 4422 | mutation rejection | A malformed mutation: bad op, table, field names or HLC. | Client bug: drop it. The rest of the frame was applied; in an atomic batch (`transact`, or `mutate` with `"atomic": true`) nothing was. |
| `trashed_rows_conflict` | 4409 | session error, not fatal; REST HTTP 409 | A declared or created table's name belongs to a dropped table whose rows in the Trash don't fit the new columns (`details.table`, `count`, `examples`, `first`). | Declare columns those rows fit, or restore and fix the rows, or have an owner purge them (`POST /v1/spaces/{space}/trash/tables/{table}/purge`), then change the columns. |
| `unique_violation` | 4409 | mutation rejection; REST HTTP 409 | A `.unique()` column already holds the value (`details.table`, `details.column`, `details.holder_id`). | Pick another value, or change the row that holds it. |
| `dependency_rejected` | 4422 | client side only (SDK) | A queued write to a row that a rejected atomic batch created; dropped with the batch. | Fix the batch (`TransactionRejectedError`) and write again. |
| `index_required` | 4422 | protocol 2 subscription error | A comparison, `$like` or `order` on a column without `.indexed()`, on a table past 10,000 live rows. | Declare the column `.indexed()` (an additive change) and retry. |
| `invalid_query` | 4422 | protocol 2 subscription error; REST HTTP 400 | The query doesn't parse or doesn't fit the space's schema. | Fix the query. |
| `query_too_large` | 4422 | protocol 2 subscription error; REST HTTP 422 | The subscription or query matches more than 10,000 rows (`details.limit`). | Narrow it with `where`, or page it with `limit` and `after`. |
| `rate_limited` | 4429 | room frame or subscription error; REST HTTP 429 | Too many requests, room frames or subscriptions. | Wait `Retry-After` / `retry_after` seconds, then retry with backoff. |
| `internal` | 4500 | session error, fatal; whole-frame rejection; REST HTTP 500 | A temporary server error. | Retry with backoff; resend the same `mutation_id`s. `@kovlet/client` retries automatically. |

Closes without an error frame: 1001 (server redeploying: reconnect after 0–2 s), 1009 (a client frame over 8 MiB: split the batch), 1006 or a network error (reconnect with backoff, 0.5 s doubling to 30 s), and HTTP 503 on the upgrade request (wait `Retry-After`). Room frames have their own non-fatal `room_error` codes (`room_full`, `too_many_rooms`, `too_large`, `not_joined`, `invalid_room_frame`); see [section 16.6 of the protocol reference](/docs/protocol#166-limits-timeouts-and-errors).

## REST error codes

Every code the REST API returns, in alphabetical order, with its HTTP status. A code can mean slightly different things on different routes. The route's response description in [/openapi.json](/openapi.json) is the precise one. Sync codes that REST also uses (`unauthenticated`, `space_not_found`, `quota_exceeded`, ...) are in the table above as well.

| Code | HTTP | Meaning | What to do |
| --- | --- | --- | --- |
| `access_denied` | 400, 403 | Device-code sign-in: the user denied the request. Consent and grants: the requested role is above the user's own role on the space. | Ask the user before trying again, or ask for a lower role. |
| `account_has_blockers` | 409 | Account deletion: spaces or an org workspace only you own, or a workspace that still holds spaces, block it (`blockers`, as in `GET /v1/me/deletion`). Nothing was deleted; the confirmation stays valid. | Hand each one over or delete it, then retry. |
| `already_member` | 409 | The person is already in the workspace. | Nothing to do. |
| `already_shared` | 409 | The person already has access to the space or is already invited. | Change their role instead. |
| `app_not_approved` | 403 | The app isn't approved where the space or workspace requires approved apps. | A workspace admin approves the app in the Kovlet console (Apps). |
| `app_revoked` | 403 | The app was revoked. | An admin restores it under Apps. |
| `app_session_required` | 403 | The route needs an app session. | Call it with the app's session token. |
| `authorization_pending` | 400 | Device-code sign-in: the user hasn't approved yet. | Keep polling every `interval` seconds. |
| `blob_not_found` | 404 | No blob with that SHA-256 is stored for the space. | Upload the bytes first. |
| `checksum_mismatch` | 400 | The uploaded bytes don't hash to the signed SHA-256. | Hash the exact bytes you send and ask for a new upload URL. |
| `concurrent_modification` | 409 | The app, grant, invite or machine changed while this request ran. | Reload and try again. |
| `concurrent_sign_in` | 409 | Another sign-in for the same account raced this one. | Retry. |
| `confirm_email_mismatch` | 400 | Account deletion: `confirm_email` isn't the account's email. | Type the account email exactly. |
| `conflict` | 409 | The request conflicts with an existing resource (for example a taken slug). | Pick another value. |
| `console_required` | 403 | The route is for the Kovlet console session only; apps and agents can't call it. | Use the app-callable route the `hint` names, or do it in the console. |
| `device_revoked` | 403 | The device key belongs to a revoked machine. | Generate a new device key and sign in again. |
| `domain_code_locked` | 429 | Too many wrong domain-verification codes. | Send a new code. |
| `domain_code_too_soon` | 429 | A domain-verification code was sent less than a minute ago. | Wait a minute. |
| `domain_not_eligible` | 403 | A consumer email domain, or the caller doesn't administer the domain's org workspace. | Use a company domain you administer. |
| `domain_verified` | 409 | The domain is already verified. | Nothing to do. |
| `email_cap_reached` | 429 | The workspace sent its daily sign-in emails (the plan's `end_user_emails_per_day`, counted over the last 24 hours). `details`: `limit`, `upgrade_url`; or `limit`, `scope: "space"` when a partner's per-space cap was hit. | Sign in another way (OAuth, guest), wait, or ask the owner to request a higher plan. |
| `email_failed` | 502 | The mail provider didn't accept the message. | Try again later. |
| `email_login_disabled` | 404 | Email sign-in isn't enabled on this server. | Use another sign-in method. |
| `end_user_blocked` | 403 | The end user is blocked in this app. | Only a space owner can unblock them. |
| `end_user_exists` | 409 | The end user id or email is taken in this space. | Use the existing end user. |
| `end_user_forbidden` | 403 | End users can only call `GET .../tables` and `GET .../records`, and can't read the Trash. | Use the end-user routes, or a member session. |
| `end_user_not_found` | 404 | No end user with that id or email in the space. | Check the id or email. |
| `end_user_wrong_space` | 403 | An end-user session is valid for one space only. | Sign the end user in on this space. |
| `end_users_disabled` | 403 | End-user sign-in is off for the app on this space. | The owner turns it on in the console (Access → End users). |
| `end_users_requirements` | 409 | The app isn't ready for end users; `details.missing` lists `approval` and/or `origins_or_redirect_uris`. | Approve the app and register its origins or redirect URIs. |
| `expired_token` | 400 | Device-code sign-in: the device code expired (10 minutes). | Start a new sign-in. |
| `external_id_taken` | 409 | Partner API: a space with this external id exists; `space_id` names it. | Use that space. |
| `file_not_found` | 404 | No file with this id in the space. | List the files to find a valid id. |
| `folder_not_found` | 404 | No live file is in the `from` folder. | Check the folder path. |
| `forbidden` | 403 | The session can't read the space, or the space's rules don't allow the table (`details.rule`). | See `hint`; ask a space owner for access. |
| `grant_request_decided` | 409 | The access request was already approved or denied. | Nothing to do. |
| `impersonation_not_allowed` | 403 | `Kovlet-As-End-User` from a session that isn't a machine, or whose machine grant lacks the impersonate flag. | A space owner sets the impersonate flag on the machine's grant. |
| `insufficient_role` | 403 | The role on the space is below what the operation needs (viewer can only read). | Ask a space owner for editor (or owner) access. |
| `insufficient_scope` | 403 | Partner API: the key lacks the scope this route needs (`required`). | Use a key with that scope. |
| `internal` | 500 | An unexpected server error; any route can answer it. | Retry with backoff. If it keeps failing, report the `X-Request-Id` of the response. |
| `invalid_change` | 400, 422 | A schema change is missing, malformed or doesn't fit the current schema. | Read the schema and retry with existing table and column names. |
| `invalid_client` | 400, 401 | Unknown `client_id`, or not an app of the user's or machine's workspace. | Register the app, or use its `client_id`. |
| `invalid_client_metadata` | 400 | OAuth client registration (`POST /v1/oauth/register`): no `client_name`, or an unsupported `grant_types` or `response_types` value. | Send a `client_name`, and only `authorization_code`, `refresh_token` or the device grant. |
| `invalid_code` | 400 | The login code or OAuth state is unknown, expired or used. | Start the sign-in again. |
| `invalid_device_key` | 400 | The device key isn't an EC P-256 public JWK. | Send a P-256 public JWK. |
| `invalid_domain_code` | 422 | The domain-verification code is wrong or expired, or none was sent. | Send a new code. |
| `invalid_email` | 400 | Not a valid email address. | Fix the address. |
| `invalid_email_code` | 400 | The end-user email code or link is wrong, expired or used up. | Ask for a new code. |
| `invalid_frame` | 400 | The body isn't valid JSON for this route (unknown fields, wrong types, over 1 MiB). | Compare the body with the OpenAPI schema. |
| `invalid_grant` | 400 | The code, device code, machine key or refresh token is wrong, used, expired or revoked, or the device proof is missing or invalid. | Start a new sign-in. |
| `invalid_id` | 400 | An id isn't valid for this route (for example not a canonical UUID). | Fix the id. |
| `invalid_login_nonce` | 400 | `login_nonce` is missing, too short, or from another browser. | Restart the login in the same browser. |
| `invalid_mailbox` | 400 | `to` isn't an allowed mailbox at the caller's domain. | Pick one of the listed mailboxes. |
| `invalid_partner_key` | 401 | Partner API: the key is unknown, revoked or expired. | Use an active `kvp_...` key. |
| `invalid_provider` | 400 | A sign-in provider setting is missing or invalid. | Fix the field the message names. |
| `invalid_query` | 400 | A query parameter or query body is malformed or doesn't fit the schema. | Fix the query. |
| `invalid_redirect_uri` | 400 | `redirect_uri` isn't registered or pinned for the app, or (client registration) isn't https, loopback http or an allowed private-use scheme. | Use a registered redirect URI. |
| `invalid_request` | 400 | The body is malformed, has unknown fields or misses a required field. | Compare it with the OpenAPI schema. |
| `invalid_return_to` | 400 | `return_to` isn't on the console's origin. | Use a console URL. |
| `invalid_rollback` | 400 | The rollback request is inconsistent. | Fix the fields the message names. |
| `invalid_scope` | 400 | `scope` is neither empty nor `agent`. | Send `agent` or nothing. |
| `invalid_signature` | 403 | The presigned upload or download URL is invalid or expired. | Ask for a new URL (they last 15 minutes). |
| `invalid_state` | 400 | The sign-in expired, was used or doesn't match. | Start the sign-in again. |
| `invalid_status` | 400 | `status` isn't one of the listed values. | Use a listed value. |
| `invalid_target` | 400 | `resource` isn't this server's `<url>/mcp`, or doesn't match the one sent at authorization. | Send `resource=<url>/mcp`, the same at both steps, or leave it out. |
| `issuer_unavailable` | 502 | The external ID-token issuer's keys could not be fetched. | Retry later; check the issuer URL. |
| `last_owner` | 409 | The change would leave the space without an owner. | Make someone else owner first. |
| `machine_key_revoked` | 409 | Partner API: the machine key was revoked. | Create a new one. |
| `machine_not_approved` | 403 | The machine isn't approved where the space or workspace requires approved machines. | A workspace admin approves it in the console (Machines). |
| `machine_revoked` | 403 | The machine (or app) was revoked. | An admin restores it under Machines. |
| `manage_required` | 403 | The caller can't manage the space. | Ask a space owner. |
| `no_app_grant` | 403, 409 | The app has no grant on the space. | Pick the space on the consent screen, or a space owner adds the app. |
| `no_machine_grant` | 403 | The machine has no grant on the space. | Approve the device code again with the space, or a space owner adds it. |
| `no_passkeys` | 409 | Account deletion: a passkey confirmation was asked for by an account without passkeys. | Confirm with an emailed code. |
| `no_user_grant` | 403 | The user isn't a member of the space. | Ask a space owner to invite them. |
| `not_a_member` | 403 | The machine has no owner who could approve the request. | Sign in with a user. |
| `not_found` | 404 | The resource doesn't exist or isn't visible to the caller. | List the parent collection to find a valid id. |
| `not_in_trash` | 404, 409 | Trash purge: the dropped table has no rows in the Trash, or the whole Trash is empty (404), or the row is live (409). Nothing was deleted. | Nothing to purge; delete a live row first. |
| `not_ready` | 503 | The server is shutting down, or its database or blob store is unavailable. | Retry with backoff. |
| `not_trashed` | 409 | The row or file isn't in the Trash. | Nothing to restore. |
| `origin_mismatch` | 403 | The request `Origin` isn't one of the app's pinned origins. | Serve the app from its registered origin. |
| `owner_required` | 403 | Only a workspace owner can change workspace roles. | Ask an owner. |
| `partner_not_enabled` | 403 | Partner access isn't turned on for this workspace. | Contact Kovlet to become a partner. |
| `partner_suspended` | 403 | Kovlet paused this partner's access. | Contact Kovlet. |
| `passkey_failed` | 400 | The passkey could not be verified. | Start the passkey ceremony again. |
| `passkeys_disabled` | 404 | Passkeys aren't enabled on this server. | Use another sign-in method. |
| `path_conflict` | 409 | Another live file holds the target path. | Move or delete it first. |
| `policy_unconfigured` | 403 | kovletd runs without a policy evaluator and fails closed. | Server configuration: run kovletd with a policy. |
| `proposal_decided` | 409 | The schema or rules proposal is no longer pending. | Nothing to do. |
| `proposal_not_found` | 404 | No proposal with this id belongs to the space. | Check the id. |
| `proposal_stale` | 409 | The table changed since the proposal was made; it is now `superseded`. | Propose again against the current schema. |
| `query_too_large` | 422 | The query matches more than 10,000 rows. | Narrow or page it. |
| `quota_exceeded` | 402 | A plan limit or per-space cap is reached (`metric`, `used`, `limit`, `upgrade_url`). | See [Plan quotas](#plan-quotas). |
| `rate_limited` | 429 | Too many requests (sign-in codes, emails, guests, partner API calls). | Wait `Retry-After` / `retry_after` seconds. |
| `reauth_failed` | 400 | Account deletion: the passkey or code didn't confirm it's you (wrong, expired, used, or started in another session). | Start the confirmation again. |
| `reauth_required` | 403 | Account deletion: no confirmation from the last 5 minutes in this session. Never a 401: the session is still valid. | Confirm with a passkey or emailed code, then retry. |
| `record_not_found` | 404 | No live row with this table and id. | Check the table and id. |
| `retention_window` | 400 | The rollback reaches further back than the plan keeps history (`retention_days`, `upgrade_url`). | Roll back less far, or request a higher plan. |
| `rows_violate_schema` | 409 | Approving `make_required`, `change_type` or a required `add_column` would leave rows (trashed ones included) that break the new definition (`table`, `column`, `op`, `reason`, `count`, `examples`). The proposal stays pending. | Fix those rows, then approve again; for a new required column, add it as optional first. |
| `rules_invalid` | 409, 422 | The rules document doesn't validate (`errors`), or a schema change drops a column the rules read. | Fix the rules first. |
| `same_workspace` | 409 | Partner API: a space can't be claimed into its partner's own workspace. | Claim it from another workspace. |
| `scope_required` | 403 | The action needs a session with a console, admin or agent scope. | Agents sign in with the device-code sign-in and `scope=agent`. |
| `secrets_key_missing` | 503 | The server has no `KOVLET_SECRETS_KEY`, so it can't store client secrets. | Server configuration: set the key. |
| `shutting_down` | 503 | The server is draining for shutdown. | Reconnect. |
| `size_mismatch` | 400 | `Content-Length` or the bytes read differ from the signed size. | Upload exactly the size you asked for. |
| `slow_down` | 400 | Device-code sign-in: polled within 5 seconds of the last poll. | Add 5 seconds to the polling interval. |
| `slug_taken` | 409 | The slug is taken in the workspace. | Pick another slug, or omit it. |
| `space_bound_machine` | 403 | A machine key a partner minted for one space can't create or ask for spaces until the space is transferred. It can still list its own space. | Use the space the key was minted for, or claim the space first. |
| `space_not_found` | 404 | No such space, or a malformed space id. | List the reachable spaces. |
| `stale_preview` | 409 | The space changed since the rollback preview. | Preview again. |
| `table_exists` | 409 | Trash purge: the table is in the schema, so its trashed rows can't be purged together. Nothing was deleted. | Purge its trashed rows one at a time. |
| `table_missing` | 409 | The row's table no longer exists. | Recreate the table first. |
| `too_large` | 413 | The file is over the per-file upload limit (5 GiB by default). | Upload a smaller file. |
| `too_many_apps` | 409 | Partner API: a space has at most 10 apps. | Remove an app first. |
| `too_many_keys` | 409 | Partner API: the partner holds 20 active keys. | Revoke one first. |
| `too_many_passkeys` | 409 | The account already has 20 passkeys. | Remove one first. |
| `transfer_accepted` | 409 | The space was already claimed. | Nothing to do. |
| `trash_changed` | 409 | Trash purge: `expect_count` differs from the dropped table's rows in the Trash now (`table`, `count`), or, when emptying the whole Trash, `expect` differs from what it holds now (`rows`, `dropped_tables`, `files`). Nothing was deleted. | Check the new counts, then purge again with them. |
| `txt_record_not_found` | 422 | The domain-verification TXT record wasn't found, or no claim was started. | Wait for DNS to propagate, then retry. |
| `unauthenticated` | 401 | The token is missing, invalid, expired or revoked. | Sign in again. |
| `unauthorized_client` | 400, 403 | The app was revoked or may not use this grant. | An admin restores the app. |
| `unavailable` | 503 | The mail provider refused the message; the message names an address to email instead. | Email that address. |
| `trashed_rows_conflict` | 409 | A `create_table` or `rename_table` onto a dropped table's name whose rows in the Trash don't fit the new columns. Nothing changed; a proposal stays pending. | Declare columns those rows fit, or restore and fix the rows, or have an owner purge them (`POST /v1/spaces/{space}/trash/tables/{table}/purge`), then change the columns. |
| `unique_violation` | 409 | A live row already holds the value in a unique column. | Change that row first. |
| `unknown_app` | 404 | Partner API: no such app on this space. | Check the app id. |
| `unknown_grant_request` | 404 | The access request is unknown, expired or someone else's. | Start a new request. |
| `unknown_machine_key` | 404 | Partner API: no such machine key on this space. | Check the key id. |
| `unknown_principal` | 403 | The session's machine, user, app or end user no longer exists. | Sign in again. |
| `unknown_provider` | 404 | No sign-in provider of that name is set up. | Use a configured provider. |
| `unknown_space` | 404 | Partner API: the partner doesn't manage this space. | Check the space id. |
| `unknown_transfer` | 404 | The claim link is invalid, expired, cancelled or for another account. | Ask the partner for a new link. |
| `unknown_user_code` | 404 | The device user code is unknown, expired or already decided. | Start a new sign-in. |
| `unsupported_grant_type` | 400 | Unknown `grant_type`. | Use one of the documented grants. |
| `upload_failed` | 400 | Reading the upload body failed. | Retry the upload. |
| `version_not_found` | 404 | The file has no such version. | List the file's versions. |
| `workspace_admin_required` | 403 | The caller isn't a workspace admin or owner. | Ask an admin. |
| `wrong_domain` | 400 | The address isn't at the workspace's primary domain. | Use an address at that domain. |

## MCP and SDK error codes

The Kovlet MCP server and the SDKs return the codes above, plus these:

| Code | Where | Meaning | What to do |
| --- | --- | --- | --- |
| `invalid_arguments` | MCP tool | The tool arguments are malformed or have unknown fields. | Compare them with the tool's `inputSchema` from `tools/list`. |
| `invalid_schema` | MCP tool | A table or column name or type is invalid. | Names use letters, digits and underscores and start with a letter; `id` is implicit. |
| `unknown_table` | MCP tool | The space has no such table. | `inspect_space_schema` lists the tables; create new ones with `propose_schema_addition`. |
| `ambiguous_space` | MCP tool | Several spaces match that name. | Pass the space id from `list_spaces`. |
| `sign_in_required` | `kovlet-mcp` bridge | The agent isn't signed in yet. | Ask the user to open the activation URL and approve, then call the tool again. |
| `server_unreachable` | `kovlet-mcp` bridge, `@kovlet/client` (HTTP status 0) | Kovlet didn't answer. | Check the URL (`https://api.kovlet.com`, or `http://127.0.0.1:8080` for `kovletd --dev`). |
| `user_session_required` | reserved | Has a hint for agents; no current route sends it. | Sign the agent in with the device-code sign-in and `scope=agent`. |
| `invalid_config` | `@kovlet/client` | `createKovletClient()` options are invalid. | Fix the options the message names. |

## Protocol limits

| Limit | Value | When exceeded |
| --- | --- | --- |
| Message size | 8,388,608 bytes (8 MiB), both directions | close 1009 |
| Mutations per `mutate` frame | 500 | close 4400 `invalid_frame` |
| Row size | 8,323,072 bytes (8 MiB − 64 KiB) | `schema_violation`, `reason: "row_too_large"` |
| HLC counter | 0–65,535 | `invalid_mutation` |
| HLC clock drift | 5 minutes ahead of server time | `clock_drift` |
| Record id | 1–256 bytes of UTF-8 | `invalid_id` |
| `hello` deadline | 10 s after the upgrade | close 4400 `invalid_frame` |
| Keepalive | ping every 30 s (10 s in a room), pong within 10 s | the socket is closed |
| Subscriptions per socket (protocol 2) | 100 | `rate_limited` |
| Rows per subscription (protocol 2) | 10,000 | `query_too_large` |
| Query size (protocol 2) | 65,536 bytes | close 4400 `invalid_frame` |
| Unindexed scan budget | 10,000 live rows per table | `index_required` |
| File upload | 5 GiB per file (`KOVLET_MAX_UPLOAD_BYTES`) | HTTP 413 `too_large` |
| Presigned URL lifetime | 15 minutes | HTTP 403 `invalid_signature` |
| REST JSON body | 1 MiB | HTTP 400 |

Rooms (presence and topics) have their own limits, advertised in `features.rooms`: see [section 16.6 of the protocol reference](/docs/protocol#166-limits-timeouts-and-errors).

## Sign-in and request limits

| Limit | Value | When exceeded |
| --- | --- | --- |
| Device code lifetime | 10 minutes | `expired_token` |
| Device code polling | at most once per 5 s | `slow_down` |
| End-user email codes per address | 5 per space per 15 minutes | HTTP 429 `rate_limited` |
| End-user email codes per client | 30 per 15 minutes | HTTP 429 `rate_limited` |
| End-user email code | 6 digits, valid 10 minutes, 5 attempts | `invalid_email_code` |
| Guest sign-ins per client | 30 per space per hour | HTTP 429 `rate_limited` |
| Idle guests | deleted after 30 days without activity | — |
| Sign-in emails per workspace | the plan's `end_user_emails_per_day`, over the last 24 hours | HTTP 429 `email_cap_reached` |
| Partner API | 20 requests per second per key, bursts up to 100 | HTTP 429 `rate_limited` with `Retry-After` |
| Partner keys | 20 active keys per partner | `too_many_keys` |
| Apps per space (partner API) | 10 | `too_many_apps` |
| Passkeys per account | 20 | `too_many_passkeys` |

## Plan quotas

Each workspace has a plan. Its limits are the defaults below unless Kovlet raised them for the workspace. Free is the default. Pro and Org are enabled on request through the upgrade form in the Kovlet console (`upgrade_url`, `/upgrade`). Custom plans start from the Org limits.

| Metric | Free | Pro | Org | What counts |
| --- | --- | --- | --- | --- |
| `spaces` | 3 | unlimited | unlimited | Data Spaces in the workspace |
| `rows` | 100,000 (new rows stop at 110,000) | 1,000,000 (new rows stop at 1,100,000) | 10,000,000 (new rows stop at 11,000,000) | live rows across the workspace; rows in the Trash don't count |
| `storage` | 1 GiB | 50 GiB | 500 GiB | file bytes across the workspace |
| `machines` | 2 | 10 | 50 | active headless machines: servers, CI, Machine Auth Keys |
| `devices` | 10 | unlimited | unlimited | active personal devices: laptops, phones, desktop apps; signing in again never counts |
| `guests` | 3 | 25 | 100 | external guests per Data Space |
| `end_users` | 1,000 | 10,000 | 50,000 | monthly active end users: app end users active in the last 30 days |
| `retention_days` | 7 days | 30 days | 90 days | how far back rollbacks reach |
| `end_user_emails_per_day` | 200 | 2,000 | 10,000 | end-user sign-in code emails per workspace, over the last 24 hours |

What happens at a limit:

- **Growth only.** A new Data Space, a new row, an upload, another headless machine or personal device, a guest invite or a new end-user sign-up is refused with `quota_exceeded`: HTTP 402 over REST, or a rejected mutation in the `ack`. The other mutations in the frame still apply. Reads, edits, deletes, exports, restores and rollbacks always keep working, and `details.reads_open` is always `true`.
- **Rows have a grace buffer.** The plan's row number is a soft limit; new rows are refused only at the hard stop, 10% above it. `details.limit` is the hard stop and `details.soft_limit` the plan's number.
- **End users.** At the `end_users` limit, existing end users keep signing in; new sign-ups are refused. At the `end_user_emails_per_day` cap, email codes stop with HTTP 429 `email_cap_reached` until the 24-hour window frees up; other sign-in methods keep working.
- **History.** A rollback past `retention_days` fails with HTTP 400 `retention_window`.
- **Per-space caps.** The [partner API](/docs/partners) can set caps on one space for `rows`, `storage`, `end_users` and `end_user_emails_per_day`. Hitting one returns the same codes with `details.scope: "space"`.
- **Warnings first.** The first frame after `hello` carries `usage`, an `ack` can carry `quota_near` warnings at 80, 90 and 100 percent, and `GET /v1/usage` returns the workspace's usage. See section 15 of the [sync protocol reference](/docs/protocol#15-usage-and-quota-signals).

`quota_exceeded` details:

| Field | Meaning |
| --- | --- |
| `metric` | `spaces`, `rows`, `storage`, `machines`, `devices`, `guests` or `end_users` |
| `used` | usage before the action |
| `limit` | the hard stop |
| `soft_limit` | rows only: the plan's included amount |
| `upgrade_url` | `/upgrade` in the Kovlet console |
| `reads_open` | always `true` |
| `space_id` | guests and per-space caps: the space concerned |
| `scope` | `"space"` when a partner's per-space cap was hit |

### Self-hosted kovletd

A self-hosted kovletd enforces the same plan defaults. Set `KOVLET_QUOTAS=false` to turn quota enforcement off, or change the free plan with `KOVLET_FREE_MAX_SPACES`, `KOVLET_FREE_MAX_ROWS`, `KOVLET_FREE_MAX_STORAGE_MB`, `KOVLET_FREE_MAX_MACHINES`, `KOVLET_FREE_MAX_DEVICES`, `KOVLET_FREE_MAX_GUESTS` and `KOVLET_FREE_RETENTION_DAYS` (`-1` is unlimited). `kovletd admin set-quota` overrides any limit for one workspace, including `--max-end-users` and `--end-user-emails-per-day`; the change applies at once.

## Next

- [Kovlet sync protocol reference](/docs/protocol): every frame, merge rule and close code in context.
- [/openapi.json](/openapi.json): the error codes of each REST route.
