SPB Git

Repository Public Research preview

errors.md 2.7 KB 42 lines markdown

1# Errors23| Status | Type | Meaning | Retry? |4|---|---|---|---|5| 400 | `invalid_request_error` | The request is wrong for this model | No — fix it (`lint`) |6| 401 | `authentication_error` | Key missing, wrong or revoked | No |7| 403 | `permission_error` | Key lacks access to the model or resource | No |8| 404 | `not_found_error` | Unknown model id or resource | No |9| 413 | `request_too_large` | Body too large | No |10| 429 | `rate_limit_error` | Rate or quota limit | Yes, after `retry-after` |11| 500 | `api_error` | Server error | Yes, with backoff |12| 529 | `overloaded_error` | API overloaded | Yes, with backoff |1314The SDKs already retry 408, 409, 429 and 5xx twice. Catch typed errors from most to least specific15(not-found → rate-limit → API status → connection) instead of one broad handler, and log the16request id.1718A **refusal is not an error**: HTTP 200 with `stop_reason: "refusal"` and a `stop_details` object.19Check for it before reading content.2021## 400s seen from the live API, and the fix2223| The API says | Fix |24|---|---|25| `"thinking.type.enabled" is not supported for this model…` | `thinking: {"type": "adaptive"}` + `output_config.effort` |26| `"thinking.type.disabled" is not supported for this model…` | Omit `thinking`, lower effort |27| `To turn thinking off on this model, send "thinking": {"type": "between_tools"}…` | Sonnet 5.5: do that |28| `adaptive thinking is not supported on this model` | 4.5 models: `{"type": "enabled", "budget_tokens": N}` |29| `temperature: Extra inputs are not permitted` / `` `temperature` is deprecated for this model. `` | Remove sampling parameters |30| `tool_choice: type "tool" and "any" are not supported for this model.` | `tool_choice: {"type": "auto"}` + instruction |31| `This model does not support assistant message prefill…` | Remove the trailing assistant turn |32| `role 'system' is not supported on this model` | Use the top-level `system` field |33| `max_tokens: N > 128000, which is the maximum allowed…` | Lower `max_tokens` |34| `This model does not support the effort parameter.` | Remove `output_config.effort` |35| `This model does not support effort level 'xhigh'. Supported levels: …` | Use a listed level |36| `output_config.effort 'xhigh' is not supported when thinking is disabled…` | Effort `high` or lower, or enable thinking |37| `…does not support the \`speed\` parameter…` | Remove `speed`, or use a model with fast mode |38| `To use the \`speed\` parameter with '…', send the \`anthropic-beta: fast-mode-2026-02-01\` header.` | Add the beta flag |39| `This model does not support user-configurable task budgets.` | Remove `task_budget` |4041The full list with the model each text came from: `references/request-rules.md`.42
Files main
Menu

Theme