# Errors

Every error has a stable `code` to branch on, a `message` for people, and a `hint` saying what to do next. This page lists every code, what causes it and what to do. The API's codes are also in the OpenAPI spec, under `Error` as `x-error-codes`.

The API returns errors as JSON at any non-2xx status:

```text
{"code": "dataset_not_found", "message": "Dataset not found.",
 "hint": "Check the id, and that it belongs to this workspace. List your datasets to find it.", "details": null}
```

The CLI prints the same three fields (as `{"error": {...}}` with `--json`) and exits with the code in [the CLI reference](cli.md#errors-and-exit-codes). The Python client raises `CloudError` with the same fields. MCP tools return them as a tool error.

## Sign-in (401)

| Code | Cause | What to do |
|---|---|---|
| `unauthorized` | No `Authorization` header | Send `Authorization: Bearer sp_...` |
| `invalid_api_key` | The key is unknown or revoked | Create a new key under **Developers** |
| `invalid_session` | A web session token expired | Sign in again, or use an API key |
| `invalid_token` | An MCP connector's sign-in expired or was revoked, or its token was sent to the REST API | Reconnect the app; use an API key for the REST API |

## Your request (400, 413, 422)

| Code | Cause | What to do |
|---|---|---|
| `invalid_request` | A field is missing or has the wrong type (422). `details` lists each field | Fix the fields in `details` |
| `bad_request` | The request could not be read | Check the body is JSON with `Content-Type: application/json` |
| `too_few_items` | The dataset has fewer than 2 items | Add items; a ranking needs at least 2 |
| `no_text_files` | An upload had no `.md`, `.txt` or `.html` file with text | Upload text files, or send the items as JSON |
| `item_too_long` | One item is over the size limit (413) | Shorten or split it |
| `too_large` | The request body is too big (413) | Send fewer items per request, then add the rest |
| `provider_unavailable` | The judge's provider can't be used by this workspace | Add an OpenRouter key in **Settings**, or use `mock` to try it free |
| `invalid_cursor` | `cursor` was changed or is from another list | Pass `next_cursor` unchanged, or leave it out for the first page |
| `invalid_webhook_url` | The webhook URL is not public `https` | Use a public `https` URL |
| `no_common_items` | Two runs being compared share no items | Compare runs on the same dataset |

## Importing a spreadsheet (400, 404, 413)

`supposing datasets push file.csv` and `run file.xlsx` use the API's import. These codes come from it.

| Code | Cause | What to do |
|---|---|---|
| `import_too_large` | The import file is over 20 MB (413) | Split it, or export only the columns you need |
| `import_unsupported` | An import file is not `.csv`, `.tsv` or `.xlsx` (`.xls` included) | Save it as `.xlsx` or CSV; upload one-document-per-file sets as files instead |
| `import_unreadable` | The spreadsheet could not be parsed | Save it again as CSV (UTF-8) or `.xlsx` |
| `import_too_wide` | More than 200 columns | Export only the columns you need |
| `import_too_many_rows` | More than 5,000 rows | Split the file |
| `import_no_such_sheet` | That sheet is not in the workbook | Use a name from the preview's `sheets` |
| `import_unknown_column` | The mapping names a column the file doesn't have | Use the column names from the preview |
| `import_no_text` | The mapping has no `text_fields` | Choose at least one column for the judge to read |
| `import_mapping_conflict` | A column is in both `text_fields` and `metadata_fields` | Put each column in one list |
| `import_no_items` | No row had text in the chosen columns | Check `text_fields` against the preview |
| `import_no_such_row` | A row preview asked for a row the sheet doesn't have | Rows count from 1, under the header |
| `import_not_found` | The import is unknown or over a day old (404) | Push the file again |
| `exclusion_not_found` | The item isn't excluded (404) | Nothing to undo |
| `review_not_found` | You haven't checked that comparison (404) | Nothing to remove |

## Not found (404)

`run_not_found`, `dataset_not_found`, `item_not_found`, `comparison_not_found`, `rubric_not_found`, `api_key_not_found`: the id does not exist, or belongs to another workspace. Check the id; list your runs or datasets to find it. `sample_not_found`: no sample dataset has that id; list the samples. `oauth_request_not_found`: an MCP connection request expired or was used; start connecting again from the app. `oauth_grant_not_found`: no such connected app in this workspace. `share_not_found`: the run is not shared, the link was revoked, or the run has not finished. `not_found` means the path itself is wrong: every route starts with `/v1`.

## Limits and conflicts (403, 405, 409, 429)

| Code | Cause | What to do |
|---|---|---|
| `plan_limit_items` | The dataset is over your plan's items per dataset | Split the items across datasets |
| `plan_limit_runs` | This month's runs are used | Wait for next month, or upgrade |
| `deletion_needs_sign_in` | Deleting a workspace was tried with an API key | Sign in to the web app and use Settings |
| `plan_limit_spend` | This month's included model spend is used | Add your own OpenRouter key in **Settings** |
| `forbidden` | The key can't do this | Use a key from the right workspace |
| `method_not_allowed` | Wrong HTTP method for this path | Check the method in [the API reference](api-reference.md) |
| `idempotency_in_progress` | A request with this `Idempotency-Key` is still running | Wait, then retry with the same key |
| `idempotency_key_reused` | The key was used for a different request | Use a new key for each new request |
| `conflict` | The resource changed under you | Read it again, then retry |
| `comparison_not_decided` | The comparison has no verdict to check yet | Wait for it to be judged |
| `workspace_pending_deletion` | The workspace is due to be deleted, so it can't start runs | Cancel the deletion in Settings |
| `run_active` | The run is still queued or running | Wait for it to finish, or cancel it first |
| `run_not_retryable` | Only failed or canceled runs can be retried | Start a new run instead |
| `rate_limited` | Too many requests | Wait a moment and retry |

## Credit and payments (402, 502, 503)

Runs on our model key are paid from your workspace's prepaid credit. See [Pricing](pricing.md).

| Code | Cause | What to do |
|---|---|---|
| `insufficient_credit` | The run's estimate is more than your balance (402). The run holds its whole estimate when it starts, so this can happen even when the run would end up cheaper | Add credit: the hint names the Billing page, and `supposing billing topup <dollars>` prints a payment link. Or lower the cost (fewer rounds, fewer items, `--top-n`, a cheaper judge), or add your own OpenRouter key in **Settings**: those runs are never billed |
| `model_not_zero_retention` | The judge model has no provider that keeps no data, and zero data retention is on | Pick another model, or (own key only) turn zero data retention off in Settings |
| `model_not_priced` | The judge model has no price tier, so a billed run can't use it | Pick another model (`supposing pricing` lists the tiers), or use your own OpenRouter key |
| `invalid_rubric` | A rubric has no text and no criteria | Write what the judge should prefer |
| `deletion_not_confirmed` | The typed workspace name doesn't match | Type the workspace name exactly |
| `exclusion_needs_detail` | An exclusion with reason `other` has no detail | Say why, e.g. "Duplicate of APP-1004" |
| `invalid_winner` | A disagreement names an item that isn't the other one in the comparison | Pick the comparison's other item, or send `agrees: true` |
| `invalid_topup` | The top-up amount is outside the allowed range | Pick a whole-dollar amount in the range `supposing billing` shows |
| `billing_disabled` | This server has no payment provider, so credit can't be bought (503) | Use your own OpenRouter key or `--provider mock` |
| `payment_provider_error` | The payment provider couldn't be reached or refused the request (502) | Try again in a minute; nothing was charged |
| `invalid_signature` | A payment webhook arrived without a valid signature. Only the payment provider calls this route | Nothing, unless you run the server: check `STRIPE_WEBHOOK_SECRET` |

With `--json`, the CLI adds `topup_url`, `topup_command` and `balance_usd` to an `insufficient_credit` error, and exits with code 8.

## Our side (500)

`internal_error`: something failed on the server. It is safe to retry. If it keeps happening, it is our bug.


`error` (400) covers any other client error the API did not give its own code. Read the `message`.

## Client and CLI codes

These come from the Python client or the CLI, never from the API.

| Code | Cause | What to do |
|---|---|---|
| `no_api_key` | No key in `SUPPOSING_API_KEY` or the saved login | Run `supposing login` |
| `connection_error` | The API could not be reached | Check the network and `SUPPOSING_API_URL` |
| `bad_response` | The server's reply was not JSON | Check `SUPPOSING_API_URL` points at the API |
| `stream_error` | A run's live event stream broke | Follow the run again; the run keeps going |
| `wait_timeout` | `runs.wait(timeout=...)` ran out | The run keeps going; follow it again |
| `no_items` | The folder has no `.md`, `.txt` or `.html` file with text, or no row of the file has text | Point at a folder of documents, or check `--text-field` |
| `invalid_file` | A JSONL, JSON or CSV file can't be read as items: a line isn't JSON, a named field doesn't exist (the message lists the real ones), no text field could be guessed, or an id repeats | Name the fields with `--text-field` and `--id-field`, as the message says |
| `not_a_folder` | The path is not a folder (or, for `run`, not a dataset id) | Check the path |
| `unknown_provider` | `--provider` is not one the CLI knows | Use one listed in `supposing rank --help` |
| `confirmation_required` | The run would cost money and `--yes` was not given (exit 7) | Check the estimate, then rerun with `--yes` |
| `not_confirmed` | You answered no at the prompt | Nothing to do |
| `run_failed` | A local run stopped because the judge failed | Rerun with the same `--state` file to continue |
| `usage` | A flag is missing or wrong | See `supposing <command> --help` |
| `mcp_not_installed` | `supposing mcp` without the `mcp` extra | `pip install 'supposing[mcp]'` |
| `interrupted` | You pressed Ctrl-C | A cloud run keeps going: `supposing runs watch <id>` |
