Skip to main content

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.

HTTPDefault codeMeaning
400bad_requestThe request is malformed in a way the schema cannot express.
401unauthenticatedMissing, invalid, inactive or expired credentials. Only a missing credential carries WWW-Authenticate: Bearer; an invalid key or token does not.
402insufficient_creditsThe account cannot pay for this operation.
403forbiddenAuthenticated, but not allowed.
404not_foundThe resource does not exist for this caller.
405method_not_allowedThe path exists, but not with this HTTP method.
409conflictThe 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.
410goneThe 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.
413payload_too_largeThe body is over its limit.
415unsupported_media_typeThe body's media type is refused. Search feedback answers unsupported_retrieval_media_type: send uncompressed application/json.
422validation_errorThe body, path or query failed schema validation; detail.errors lists every field problem.
422unprocessableA route refused a well-formed request without naming a more specific code. There is no detail.errors.
429rate_limitedToo many requests. See Retry policy.
500internal_errorAn unexpected server failure.
502upstream_errorA 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.
503unavailableTemporarily unavailable (for example training_unavailable). The training data views answer frozen_dataset_busy with Retry-After: 2.
504upstream_timeoutThe 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.

CodeHTTPRetry-AfterMeaning
model_warming503yesThe model is starting or temporarily busy. Retry after the supplied delay, a bounded number of times.
overloaded503n/aReserved and not sent today; a busy model answers model_warming.
ambiguous_transport502noThe request may have reached the model. Do not blindly retry.
upstream_error502noThe model failed after accepting the request.
model_not_supported400noThe base model was never in the catalog.
model_deprecated410noThe base used by a request or fine-tune is retired. Retrain on the current catalog.
model_not_found404noA well-formed alias or training-job reference does not resolve for this caller.
invalid_request400, 413, or 422noDeterministic 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_value400noA 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_credits402noThe account cannot pay for this request or is not entitled to the model.
authentication_error401noThe bearer was verified but no ReOpenly account backs it.
project_capability_mismatch409noThe project does not expose the capability required by this route.
capacity_unavailable503yesThe 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_ready503yesThe embedding model is not ready to serve yet. Retry after Retry-After.
upstream_validation_error422noThe embedding model returned output that failed validation (malformed, non-finite, wrong size or order), so it was not returned.
upstream_ambiguous502noThe embedding request may have reached the model; it was not retried. Do not blindly retry.
project_archived404noThe project is reversible but read-only until an owner unarchives it.
internal_error500noAn 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:

CodeHTTPWhere
model_warming503Text inference: chat and legacy completions.
capacity_unavailable503Embeddings and the embedding Playground.
artifact_not_ready503Embeddings and the embedding Playground.
frozen_dataset_busy503The training data views, with Retry-After: 2.
retrieval_ingest_rate_limited429Search 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 4xx request, validation, permission or billing error (400, 401, 402, 403, 404, 405, 409, 410, 413, 415, 422), including invalid_request, unsupported_value, insufficient_credits, model_deprecated and project_archived: the request, the account or the project has to change first;
  • ambiguous_transport and upstream_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_error and any other 5xx without Retry-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.