Skip to main content

Error codes

What each status code means and what to do about it.

The error envelope​

Every error a /v1/ endpoint returns has the same shape — validation failures included. Branch on error.code, which is stable; never on the message, which is not.

{
"error": {
"code": "not_found",
"message": "Avatar not found"
}
}

A request that matches no endpoint is the exception: an unknown path returns the framework's plain {"detail": "Not Found"} with a 404, and a wrong method {"detail": "Method Not Allowed"} with a 405. A 404 with no error.code means the URL is wrong — check the path and method before looking for a missing resource.

Statuserror.codeMost common cause
400invalid_requestA file the upload endpoints reject — one is enough to fail a whole batch; a value the endpoint cannot accept
401invalid_api_keyMissing X-Api-Key header, a mistyped key, or a revoked key — see below
404not_foundWrong ID, an avatar that is not ready, or a resource on another account
409conflictAction conflicts with current state — training already running
413file_too_largeA training video over 2 GB on POST /v1/videos/upload-url
422validation_errorMalformed body, or a value outside an allowed option list
429rate_limit_exceededMore than 100 requests in one 60-second window for that key
500internal_errorUpload or storage failure
502upstream_errorSystem-prompt generation failed on avatar create or persona update

401 — the one you will hit most​

API keys do not expire, so a 401 is never staleness. It is one of three things:

CauseHow to tell
Header missing or misspelledThe header must be exactly X-Api-Key
Key does not existMistyped or truncated — the full secret is shown once, so copy all of it
Key revokedRevocation is immediate; check the dashboard under API

A valid key from a different account is not a 401: it authenticates, and that account's view of your resources is a 404. GET /v1/me returns the account a key belongs to.

cURL
curl -s "https://backend.goldenengine.ai/v1/me" \
-H "X-Api-Key: $GOLDENENGINE_API_KEY"

429 — rate limited​

The limit is 100 requests per minute per key, counted in a fixed 60-second window that opens with the key's first request. Only requests that authenticate count, so 401s do not use up the budget. The wait is in the envelope, not a header:

{
"error": {
"code": "rate_limit_exceeded",
"message": "Rate limit exceeded",
"retry_after_seconds": 37
}
}

There is no Retry-After header — read error.retry_after_seconds and wait that long rather than retrying immediately. Because the budget is per key, splitting work across several keys raises your total throughput.

404 on a conversation​

POST /v1/conversations returns 404 for three distinct situations, which the message deliberately does not distinguish:

  • The avatar ID does not exist
  • The avatar is not ready — still pending, queued, training, or failed
  • The avatar belongs to another account

Check the avatar first:

cURL
curl -s "https://backend.goldenengine.ai/v1/avatars/$AVATAR_ID/status" \
-H "X-Api-Key: $GOLDENENGINE_API_KEY"

If it is stock, remember GET /v1/avatars will not show it — use GET /v1/avatars/stock.

409 on training​

EndpointMeaning
POST /v1/avatars/{id}/retrainA training run is already active — wait or cancel it
POST /v1/avatars/{id}/cancelNothing is running to cancel
POST /v1/avatars/{id}/preloadThe avatar is not ready

207 on a batch upload​

POST /v1/knowledge-bank/upload/batch and POST /v1/avatars/{avatar_id}/knowledge/batch return 207 when at least one file in the batch was not queued. It is not an error and does not carry the envelope. The body is the same batch response a 201 returns, with failed above zero and an error — code and message — on each entry of results that did not go through. The other entries carry their item and are processing normally, so treat 207 as a partial success: report the failed files, not the request.

A 207 only ever comes from a server-side failure after validation passed, and error.code says which:

error.codeWhat happeneditem
upload_failedThe file could not be storedAbsent — nothing was saved
queue_unavailableThe file was stored but its processing job could not be queuedPresent, with status: "failed"

Anything wrong with the request itself fails the whole batch with an ordinary 400 before anything is uploaded or queued: no files or more than five, an empty file, a file over 50 MB, a file without a filename, an extension other than .pdf or .docx, or a content type other than PDF or DOCX. The message names the offending file as files[<index>] (<filename>).

422 — validation errors​

Validation failures use the same envelope as every other error. The message names the field that failed, as a dotted path:

{
"error": {
"code": "validation_error",
"message": "body.primary_language: Value error, Invalid primary_language: Klingon"
}
}

Only the first failure is reported, so a request with three bad fields returns one message and needs re-sending after each fix. Beyond ordinary type errors, the usual cause is sending a value outside an allowed option list — the accepted values are listed on the request body in the API reference rather than hard-coding them. On POST /v1/conversations, an end_user_id longer than 128 characters, containing control characters, or starting with the reserved anon: prefix fails the same way.

502 on avatar create or update​

Creating an avatar generates its system prompt through a language model. An update does so only when it changes a persona field — name, bio, awards_achievements, known_for, personality_traits, or interaction_guardrails; changing only the voice, models, or other settings never calls the provider. When that upstream call fails you get 502; on create, the avatar is not created. Retry; if it persists, the provider is likely degraded.

WebSocket errors​

The conversation socket reports failures as close codes, not HTTP statuses. The engine sends 4001, and 4503 or 4404 when it can tell at once, before it accepts the connection, and a browser never sees a code sent at that point: the handshake fails and onclose reports 1006 without onopen having fired. The codes below reach a browser only when they are sent after the connection opened.

Close codeMeaningWhat to do
4001Invalid or expired session token. Seen by a browser as 1006 before onopenCreate a new conversation. Do not retry the same URL
4503pod_at_capacity — the engine has no free session slotRetry after a short backoff; if it persists, you are at capacity
4404The avatar's trained files are missing on the engineNot fixable by retrying; report it with the avatar ID
4500The avatar or the engine failed to load for this sessionRetry once; if it repeats, report it with the avatar ID
Other non-normal closesNetwork dropReconnect if the token is still inside its 60 minutes; otherwise create a new conversation

Troubleshooting​

The avatar answers generically and ignores my documents

Confirm the documents are attached to that avatar (GET /v1/avatars/{id}/knowledge). A document left unattached in the account bank (GET /v1/knowledge-bank) is used by no avatar, and one attached to a different avatar is invisible to this one. Then check that each reached completed with a non-zero chunk_count. For documents still in the bank, POST /v1/knowledge-bank/search shows whether the question finds good chunks; it does not search documents attached to one of your avatars.

My uploaded document failed with “Document contains no extractable text”

The file has no text layer. This is nearly always a scanned or image-only PDF. Run it through OCR and upload again. “Could not extract text from document” means the file could not be parsed at all; check that it opens in a normal viewer, then upload it again.

Training failed

Read error_message on the avatar or via GET /v1/avatars/{id}/training-jobs. Most failures come from the source video — subject leaving frame, inconsistent lighting, multiple people, or too little usable footage. Re-read the recording guide before re-shooting.

The session is refused as soon as it starts

The session token expired or was altered. Tokens last 60 minutes, so this usually means too long between creating the conversation and the visitor loading it. An embed that loads with an expired token shows its "Session Expired" screen. A token that expires after the page loaded — say, while the visitor sits on the Start screen — shows a generic connection error instead, because the refusal arrives as 1006. Create the conversation at the moment the visitor clicks to start, and pass conversation_url through unmodified, query string included.

Audio plays but the lips are out of sync

The embed paces frames against audio playback, so persistent drift is a bug worth reporting rather than something to tune. The realtime protocol explains the mechanism.

A stock avatar does not appear in my list

GET /v1/avatars returns only avatars you created. Use GET /v1/avatars/stock for the pre-trained set. There is no endpoint returning both — call each and merge.