Errors and retries
REST API errors
Every refusal from the REST API (/api/v1/...) has the same body:
{
"detail": {
"code": "training_slot_occupied",
"message": "You already have a training run in progress. Wait for it to finish, or stop it, before starting another."
}
}
Branch on detail.code; show detail.message. Some errors add fields, such as
field for a refused setting, or successor for a retired path. Codes are
stable within /api/v1: a new code can appear, and an existing one keeps its
meaning. A message is written for the person reading it and may be reworded to
say more clearly what is wrong and what to do; never match on its text.
| HTTP | Default code | Meaning |
|---|---|---|
| 400 | bad_request | The request is malformed in a way the schema cannot express. |
| 401 | unauthenticated | Missing, invalid, inactive or expired credentials. Only a missing credential carries WWW-Authenticate: Bearer; an invalid key or token does not. |
| 402 | insufficient_credits | The account cannot pay for this operation. |
| 403 | forbidden | Authenticated, but not allowed. |
| 404 | not_found | The resource does not exist for this caller. |
| 405 | method_not_allowed | The path exists, but not with this HTTP method. |
| 409 | conflict | The resource's current state refuses the operation (for example training_slot_occupied or project_capability_mismatch). A write to an archived project answers 409 conflict with no more specific code: unarchive the project first. |
| 410 | gone | The resource is permanently gone. A retired unversioned path answers api_version_required instead, with the path to use in detail.successor and a Link: <successor>; rel="successor-version" header. |
| 413 | payload_too_large | The body is over its limit. |
| 415 | unsupported_media_type | The body's media type is refused. Search feedback answers unsupported_retrieval_media_type: send uncompressed application/json. |
| 422 | validation_error | The body, path or query failed schema validation; detail.errors lists every field problem. |
| 422 | unprocessable | A route refused a well-formed request without naming a more specific code. There is no detail.errors. |
| 429 | rate_limited | Too many requests. See Retry policy. |
| 500 | internal_error | An unexpected server failure. |
| 502 | upstream_error | A service ReOpenly depends on failed (for example, a checkout could not start). The training data views answer a specific code, for example frozen_dataset_unavailable. |
| 503 | unavailable | Temporarily unavailable (for example training_unavailable). The training data views answer frozen_dataset_busy with Retry-After: 2. |
| 504 | upstream_timeout | The operation took too long. The training data views answer frozen_dataset_timeout or frozen_dataset_cancelled. |
A route may return a more specific code with the same status, for example
training_slot_occupied (409) or embedding_selection_changed (409). The
table gives the fallback for each status. The training data views are
GET /api/v1/projects/{owner_slug}/{project_slug}/training-jobs/{job_id}/dataset
and .../dataset/{chat_id}.
Invalid cursors
A cursor that is malformed, or that came from another list or filter, answers
400. The code depends on the list: search feedback, Search (corpora,
versions, indexes), embedding datasets and examples, GET /api/v1/models and
GET /api/v1/activity answer invalid_cursor; the other lists (training jobs,
chats, projects, hosted models, API keys, usage statements, playground sessions)
answer bad_request. Either way, restart from the first page.
Send Content-Type: application/json with every JSON request body, on the
REST and OpenAI-compatible routes alike. A JSON body sent without it, or with
another type such as application/x-www-form-urlencoded (what curl -d sends
by default), is not read as JSON, and the request fails with 422.
OpenAI-compatible errors
Model and serving failures on the OpenAI-compatible routes, including legacy
/v1/completions, use this machine-readable envelope:
{
"error": {
"message": "This project is archived. Unarchive it in project settings to serve requests.",
"type": "invalid_request_error",
"code": "project_archived",
"param": null
}
}
Credential checks and request validation happen before the model is reached.
On these routes their failures have a top-level detail instead:
{
"detail": "Invalid or inactive API key"
}
For validation, detail is an array of field errors: a field of the wrong type
or shape answers 422. A well-formed value that is out of range or cannot be
honored (for example temperature: 3 or n: 2) is refused afterwards, with the
envelope above and 400. Read error.code when
error is present; otherwise handle detail as a credential or request
failure. Never branch on English message text.
One exception under /api/v1. The embedding Playground routes,
/api/v1/playground/embeddings/vector, /api/v1/playground/embeddings/similarity
and the same two under /api/v1/projects/{owner_slug}/{project_slug}/playground/embeddings/,
answer model and serving failures with the {"error": {...}} envelope above,
like the OpenAI-compatible routes. Their authentication, project access and
validation failures use the /api/v1 detail body.
Stable codes
These are the error.code values of the OpenAI-compatible and embedding
Playground routes.
| Code | HTTP | Retry-After | Meaning |
|---|---|---|---|
model_warming | 503 | yes | The model is starting or temporarily busy. Retry after the supplied delay, a bounded number of times. |
overloaded | 503 | n/a | Reserved and not sent today; a busy model answers model_warming. |
ambiguous_transport | 502 | no | The request may have reached the model. Do not blindly retry. |
upstream_error | 502 | no | The model failed after accepting the request. |
model_not_supported | 400 | no | The base model was never in the catalog. |
model_deprecated | 410 | no | The base used by a request or fine-tune is retired. Retrain on the current catalog. |
model_not_found | 404 | no | A well-formed alias or training-job reference does not resolve for this caller. |
invalid_request | 400, 413, or 422 | no | Deterministic request error. For chat and legacy completions, 400 covers a value outside its range (temperature 0 to 2, top_p 0 to 1, max_tokens at least 1, penalties -2 to 2, at most 4 stop sequences) or malformed (response_format without a schema), with error.param naming the field. For embeddings, 400 covers more than 64 inputs or 32,768 tokens in one request, an input over the model's input limit (512 tokens, or its training length up to 2,048), or unsupported dimensions; error.param identifies input for the input limits. |
unsupported_value | 400 | no | A valid OpenAI value this API cannot honor, such as n above 1, logprobs: true, tool_choice: "required", or stream: true on legacy completions; also an option the model serving the request cannot apply at that moment. error.param names the field. Send it at its default or leave it out. |
insufficient_credits | 402 | no | The account cannot pay for this request or is not entitled to the model. |
authentication_error | 401 | no | The bearer was verified but no ReOpenly account backs it. |
project_capability_mismatch | 409 | no | The project does not expose the capability required by this route. |
capacity_unavailable | 503 | yes | The embedding model cannot take the request now: it is starting, or more requests arrived at once than it can serve. Retry after Retry-After. |
artifact_not_ready | 503 | yes | The embedding model is not ready to serve yet. Retry after Retry-After. |
upstream_validation_error | 422 | no | The embedding model returned output that failed validation (malformed, non-finite, wrong size or order), so it was not returned. |
upstream_ambiguous | 502 | no | The embedding request may have reached the model; it was not retried. Do not blindly retry. |
project_archived | 404 | no | The project is reversible but read-only until an owner unarchives it. |
internal_error | 500 | no | An unexpected server failure. If it persists, write to reopenly@gmail.com with the x-trace-id response header. |
model_deprecated is permanent for that base: the earlier 0.8B, 2B and 4B text
bases are retired. Models trained on them remain downloadable, but serving and
publishing an alias on a retired base are blocked.
Retry policy
Retry automatically only when the response carries Retry-After. Wait at
least that many seconds, resend the same request (same body, and the same
Idempotency-Key where the route takes one), and stop after a few attempts,
waiting longer before each one. These codes carry it:
| Code | HTTP | Where |
|---|---|---|
model_warming | 503 | Text inference: chat and legacy completions. |
capacity_unavailable | 503 | Embeddings and the embedding Playground. |
artifact_not_ready | 503 | Embeddings and the embedding Playground. |
frozen_dataset_busy | 503 | The training data views, with Retry-After: 2. |
retrieval_ingest_rate_limited | 429 | Search feedback writes, until the current minute ends. |
One code carries Retry-After but does not clear by waiting:
retrieval_dataset_quota_exceeded (429) means the dataset's stored search
feedback is full, and nothing expires on its own. Do not loop on it.
overloaded is reserved and not sent today.
A 429 without Retry-After (the public pricing endpoints) asks you to slow
down: wait before sending more.
The ReOpenly playground makes at most three automatic retries after the original request, then keeps a manual Retry action. It never retries an error that arrives mid-stream.
Never retry automatically:
- a
4xxrequest, validation, permission or billing error (400,401,402,403,404,405,409,410,413,415,422), includinginvalid_request,unsupported_value,insufficient_credits,model_deprecatedandproject_archived: the request, the account or the project has to change first; ambiguous_transportandupstream_ambiguous, because the model may already have served the request and billing may already be recorded;upstream_error, because the model already accepted the request;internal_errorand any other5xxwithoutRetry-After.
Streaming failures
Before the first SSE frame, errors use the normal HTTP status and JSON body. After the stream begins, a mid-stream failure is sent as:
data: {"error":{"message":"…","type":"api_error","code":"upstream_error","param":null}}
The server then closes the stream without sending data: [DONE]. Treat the
absence of [DONE] as incomplete output, not as a successful empty response.