Real-time transcription
Errors in a session
How a refused or failed session ends: its error message, its close code, and what to do.
A refused or failed session gets one error message, then the server closes the connection with a close code. Every refusal comes after the WebSocket opens, so a browser can read the reason too. Every code of the API: Errors.
{"type": "error", "code": "invalid_parameter", "message": "diarise: unknown parameter", "param": "diarise"}| code (close code) | What it means | What to do |
|---|---|---|
unauthorized (1008) | No key or token, or one that is not valid: a revoked or expired key, or a token used, expired or of the wrong type. | Check the key; make a new token for every session. |
invalid_parameter (1008) | A query parameter is unknown, empty, not supported or out of range (param names it), one is sent without the one it needs (speaker_updates without diarize=true, turn_sensitivity without commit=turn), commit=turn with a model that is not Romanian, a vocabulary_id that names no vocabulary of your workspace, a vocabulary message with a bad entry (param entries[3]), or a text message is not one the API knows (param type). | Fix it. |
capacity (1013) | All your workspace's live sessions are in use (a two-channel session needs 2), or no speech service is free for a moment. A workspace runs 10 at a time: "This account can run 10 real-time sessions at a time: try again when one ends." | End another session, or try again shortly (Limits and free credit). |
| an error before session.started (1013) | The workspace is paused: its credit is used up, or it reached its hourly spend limit. The message says which. | Add credit, or wait for the spend to fall under the limit (Limits and free credit). |
audio_chunk_too_large (1009) | A frame of more than 1 s of audio. | Send smaller frames: 100 ms is best. |
idle_timeout (1008) | 15 seconds without audio or messages. | Send silence or {"type": "ping"} while paused. |
session_time_limit (1008) | The session reached the longest a session runs: 4 hours. Its last finals come before the error. | Open a new session and go on with the audio that comes next. |
transcriber_error (1011) | The speech service or speaker separation failed, was not available at the start, or did not finish within 30 s of your end. The close code is 1012 when a speech service stopped for an update. | Connect again (Reconnect after a restart). |
internal_error (1011) | An error on our side, or a saved vocabulary that cannot be read for a moment. | Connect again. |
service_restart (1012) | The server restarts. The finals of all the audio it received come first, and resume_s says from which second to send the audio again. | Connect again: Reconnect after a restart. |
| close 1006, no error | The connection dropped, or it failed before the WebSocket opened (a wrong host or path). | Check the address, then connect again. |
Clients that stop on the right errors
Retry only the ends a new session can get past: service_restart, transcriber_error, internal_error, a dropped connection, and capacity for a short while. The others need a change on your side first.