Error categories
Branch on the category, not on the message text, because the message text can change without notice.
Each client uses its own name for each category:
Go and Rust error names
Go and Rust error names
WebSocket upgrade refusals
WebSocket upgrade refusals
Before a WebSocket stream starts, the server can refuse the upgrade. It sends an HTTP response, and no
error event follows.Decide whether to retry
Retry only when you still have the audio, and always retry on a new stream. The SDK does not retry or send audio again on its own. Keep the transcript of each attempt separate, and log the request ID of each attempt. A resource-limit error does not always say whether the request went over a limit or the service had no capacity for it. Handle a resource-limit error in this order:- Compare what you sent with the limits that you can measure. These are the size of each message and of the utterance, the context terms, and the 120-second limit. If the request went over a limit, fix the request rather than retry it. For example, a direct client that sent an audio message over 64 KiB must split that message, not shorten the utterance.
- If the request is within these limits, the cause is unknown. Retry a small number of times, such as two or three. Use backoff and a new stream for each attempt.
- If the error continues, the likely cause is the model’s context or generation token cap. This cause comes back on every retry of the same audio. Split the audio across streams, or shorten the context terms.
A timeout comes back on retry if you do not fix its cause. To prevent one, send
start or config as soon as you connect, send audio through pauses, and end each utterance well before the 120-second limit.
Limits
Two of these limits deserve more explanation:
15 seconds without audio. These events change the timer:
Model context and chunking. Each backend decode reads its audio window, the mode prompt, your context terms, and any fixed transcript prefix inside the model’s context limit (2,048 tokens by default), and generates up to 25 tokens per second of decoded audio plus 32 (plus rolled-back tokens on revised decodes), capped at 1,500 tokens. The service never silently truncates a transcript that hits the context or generation cap: it returns
resource_exhausted (RESOURCE_EXHAUSTED). How audio fits into each decode depends on the path:
- Revised hypotheses in non-CJK languages (
ar,de,en,es,fr,hi,id,it,nl,pt): Once the language is selected or locked, each decode processes a sliding window of at most two 8-second audio blocks (up to 24 seconds while holding an older block) plus new audio since the previous decode. Earlier words commit as older blocks drop, so the context does not grow across the whole utterance. - Revised hypotheses in
cmn,ja,ko, or while detecting a language: The service keeps all audio in the model’s context until the utterance ends (or, for non-CJK languages, until detection locks at 8 seconds or more with at least three letters). Long utterances incmn,ja, orko, or long silence before speech under detection, can fill the model context before the 120-second stream limit. - Append fragments: The service decodes each five-second window on its own (joining a trailing remainder under 0.5 seconds onto the last window), so the context does not grow with the utterance.
- Whole-file
Transcribe: Fixed-frame WAV files (PCM, IEEE float, A-law, or mu-law) longer than 30 seconds are decoded in 30-second pieces (joining a trailing remainder under 0.5 seconds onto the previous piece), and piece transcripts are joined with a space. Non-fixed-frame WAV encodings are decoded whole and fail withRESOURCE_EXHAUSTEDif cut by the context or 1,500-token cap.
Common problems
The SDK fails as soon as you create the client
IfRIME_API_KEY is missing or empty when you create the client, Python and Node.js raise RimeAuthenticationError at that point, before any request. The SDK does not read .env files, so set the variable in the environment that runs your code, and keep its value out of logs.
Rime refuses the API key
If Rime does not accept the key, it refuses the stream before the stream starts. The SDK raises its authentication error, a WebSocket upgrade gets HTTP401, and gRPC returns UNAUTHENTICATED. Check that the key is current, or create a new key.
A stream fails with invalid input after it started
When you omitlanguage or send und on the direct WebSocket or gRPC API, the service accepts the stream before it hears the speaker. Once detection locks (at 8 seconds or more with at least three letters) or on the final decode, the service fails the stream with invalid_input (INVALID_ARGUMENT) if the detected language is not in the 13-language catalog, or if the detected language does not allow the requested mode (for example, tagged mode with Japanese speech, or verbatim mode with Indonesian speech). Pass language explicitly when you know it, or use written mode when detecting across languages.
Words repeat in the transcript
Your code appends partial transcripts. Replace each one instead.Partials arrive, but no final transcript
The stream still waits for the end of the audio. End the audio source:The stream times out during a pause
The service got no audio for 15 seconds. Send captured audio through every pause. If a step before your backend drops silent frames, fill the gap with frames of zeros.The transcript is poor or empty
Check these items in order:- Language. When you select a language explicitly, speech in a different language returns a poor transcript rather than an error. Verify that the tag matches the speaker’s language, or use automatic language detection on the direct APIs.
- Audio format. The SDK reads every byte as PCM16 samples. Remove a WAV header, and decode MP3 or mu-law audio, before you send it. Set
input_formatto the rate and channel count of your capture. - Silence. An empty final transcript is a successful result for audio with no recognizable speech.
- Names and jargon. Add context terms for words that the model gets wrong, and remove unrelated terms.
A long turn or recording fails
A timeout near 120 seconds means the stream reached its wall-clock deadline. A resource-limit error late in a long utterance (most common incmn, ja, ko, or with a long list of context terms) means the decode ran out of model context or hit the generation token cap. A retry of the same audio fails again, so split long audio across streams:
- Live audio: End long turns at a pause well before the 120-second deadline (and after about a minute of speech in
cmn,ja, orko), and start the next stream immediately. Split long turns at pauses shows how to do this with the SDK, and how to join the final transcripts. - Recordings: Fixed-frame WAV files up to 16 MiB and 524 seconds can use
Transcribe(as long as recognition completes within the 120-second deadline). For longer recordings, stream the file in parts of at most 16 MiB with append fragments, through the SDK’s append fragments option or the WebSocket or gRPC API, as Transcribe a long recording describes.
Report a failure
Get the request ID from the stream, or from the error that it raised:
Email support@rime.ai with:
- the request ID and the UTC time of the failure
- the error category and its message
- the SDK and version, or the transport that you called directly
- the audio format, and how your code ended the audio
Before production
- Your API key is only on your backend.
- You pin your SDK version, because the packages are in alpha.
- Your code acts only on final transcripts.
- You log the request ID of every stream.
- Each stream opens when speech starts, and your backend sends silence during pauses.
- You split long turns at pauses before the 120-second limit (and after about a minute in
cmn,ja, orko), and split recordings over 16 MiB across calls or append-fragment streams. - Each error category has a handler, and each retry uses a new stream.
- You set
languagefrom what you know about the speaker, or handle mid-streaminvalid_inputfailures when using automatic language detection on direct APIs. - You match
modeto the languages that support it (written for all 13, verbatim for all exceptid, tagged forde,en,es,fr,it, andnl).

