Skip to navigation

Errors

Every WebSocket close code, then the HTTP statuses for file transcription.

How errors are reported

Streaming reports problems on the WebSocket in two ways:

  • An Error message, sent immediately before the server closes the connection.
  • A WebSocket close code, which identifies the cause.
{ "type": "Error", "message": "Invalid audio config: missing sample_rate" }

Decide what to do based on the close code, not the message text. The text is for people and may change. The exceptions are insufficient_credits, api_key_revoked, initial_timeout and idle_timeout, which are stable values.

Every Error closes the connection. There are no non-fatal errors on this endpoint.

Speech to Text and Text to Speech use different close codes. For example, an invalid API key closes a Speech to Text connection with 4001 and a Text to Speech WebSocket with 1008. For Text to Speech errors, see Errors & Warnings.

File transcription returns HTTP statuses. Those are listed after the streaming close codes.

Close codes

CodeCauseExample messageWhat to doRetry?
1000Normal close after you sent CloseStream-Nothing.-
4001Invalid or missing API keyUnauthorized: Invalid or missing API keyCheck the key and how you send it.No
4002Invalid AudioConfig, audio that cannot be decoded, a text frame that is not a JSON object, an invalid query parameter, or diarize=true with bvc=trueInvalid audio config: missing sample_rate. Combining diarization with background voice cancellation closes with reason diarize and bvc cannot be combined.Fix the audio format, message or query parameter. For mode, only native or romanized is accepted. Do not set diarize and bvc together. See Script mode. See Audio formats.No, not unchanged
4003Insufficient credits when connecting-Top up in the dashboard.After top-up
4004Streaming concurrency limit for this API key reached. Each open connection uses one slot until it closes (5 on the free tier; pay as you go is 20 by default, up to 150 on request)-Retry with exponential backoff, or see Rate Limits & Concurrency.Yes, with backoff
4005Credits ran out during the sessioninsufficient_creditsTop up, then reconnect.After top-up
4006API key revoked during the sessionapi_key_revokedUse a valid key.No
4008No audio or KeepAlive received after connecting (initial_timeout), or since the last audio or KeepAlive (idle_timeout)idle_timeoutSend audio or KeepAlive more often. See Keeping the connection open.Yes
4010Billing service unreachable when connecting-Retry with exponential backoff.Yes, with backoff
4011Speech detection unavailable when connectinginternal_errorRetry with exponential backoff.Yes, with backoff

A WebSocket request to an unknown path is rejected with HTTP 404 before the connection opens.

Low balance warning

When your balance reaches the warning threshold, the server sends one QuotaWarning message per session. This is not an error: the stream keeps running until credits run out (close 4005) or you close it.

{ "type": "QuotaWarning", "remaining_funds": 0.001875 }

remaining_funds is your remaining workspace balance in USD.

import json
import websockets
RETRYABLE = {4004, 4008, 4010, 4011}
async def read_results(ws):
try:
async for raw in ws:
msg = json.loads(raw)
if msg["type"] in ("partial", "final"):
handle_transcript(msg)
elif msg["type"] == "QuotaWarning":
notify_low_balance(msg["remaining_funds"])
elif msg["type"] == "Error":
log_error(msg["message"])
except websockets.ConnectionClosedError:
pass
if ws.close_code in RETRYABLE:
schedule_reconnect_with_backoff()
elif ws.close_code != 1000:
alert(f"Speech to Text closed with code {ws.close_code}")

Contacting support

Include the following in your support request:

  • the rawEvent.request_id from any partial or final message on the connection
  • the close code and the message text
  • the host you connected to
  • the approximate time of the session

If the connection closed before any partial or final message (for example an auth failure with code 4001), there is no request_id. Include the time of the attempt, the host, how you sent the key, and the close code.

File transcription

File transcription returns an HTTP status. Branch on the status and, when the body includes one, on detail.code or error.code. Message text can change.

StatusCauseExample bodyWhat to doRetry?
400The model or language belongs on the other host, the file part has no filename, the audio cannot be decoded, the audio is longer than 3600 seconds, mode is a value other than native or romanized, or a diarization field is invalidredirect_url points at the other host. A missing filename is No file provided. An undecodable file is Unable to decode audio file. An invalid mode is mode must be native or romanized. Diarization returns {"detail": "..."}: diarize and bvc cannot be combined, num_speakers must be an integer, num_speakers must be between 1 and 32 (the same two messages for min_speakers and max_speakers), num_speakers cannot be combined with min_speakers/max_speakers, or min_speakers cannot exceed max_speakers.Send the model to its own host, name the file, or send WAV, FLAC, or OGG under 1 hour. Fix the diarization fields. See File transcription.No, not unchanged
401Missing or invalid API key. A poll with no key also returns 401.Invalid key on upload: {"detail": "invalid_api_key"}. Missing key on poll: {"detail": "Unauthorized: Invalid or missing API key"}.Send the api-key header.No
402The account cannot be charged for this request-Top up in the dashboard.After top-up
404Polling an unknown id, an expired id, or an id that was submitted with a different API key-Poll the host you uploaded to, with the same API key, within 24 hours of the job finishing.No
413The upload is over 1 GB-Send a smaller file.No, not unchanged
422The request has no file field. This is returned before the API key is checked.{"detail": [{"type": "missing", "loc": ["body", "file"], "msg": "Field required"}]}Send file as a form field.No, not unchanged
429That server already has 8 file jobs runningoffline transcription capacity reachedRetry with backoff. See Rate Limits & Concurrency.Yes, with backoff
429The account concurrency check failedconcurrency_limit_reachedRetry with backoff. This is separate from the 8-job server cap.Yes, with backoff
500Transcription failed, or an unexpected server error{"detail": {"code": "transcription_failed", "message": "...", "transcription_id": "..."}}code is transcription_failed or internal_error. Retry. Contact support with transcription_id if it repeats.Yes
503Billing is unavailablebilling_unavailableRetry with backoff.Yes, with backoff
504The job did not finish within the longer of 15 minutes and the audio length{"detail": {"code": "processing_timeout", "message": "...", "transcription_id": "..."}}Retry.Yes

If the server has already sent the 200 headers for a long job, the same detail object arrives in that body. Check for detail before you read the transcript. When the synchronous wait reaches 600 seconds, the body includes the transcription_id and the job keeps running:

{ "detail": "offline transcription timed out", "transcription_id": "..." }

Poll that id. See Synchronous response.

A webhook or poll that fails uses error.code. A completed job can also include warnings.

CodeWhereMeaning
processing_timeouterror.codePart of the audio was not transcribed in time.
transcription_failederror.codeNone of the speech in the file could be transcribed.
internal_errorerror.codeUnexpected server error.
partial_audio_droppedwarnings[].codeSome segments were left out. The rest of the transcript is returned. dropped_audio_secs is how many seconds were dropped.

Audio with no speech is a completed transcript with an empty text. It is not one of these codes. Delivery and retry behaviour is on File transcription.