{"record":{"id":"9c91c3d83c7aa40a","repo":"BerriAI/litellm","slug":"could-not-decode-audio-for-riva-stt-convert-your","errorCode":null,"errorMessage":"Could not decode audio for Riva STT. Convert your audio to wav/flac/ogg before calling the API. Underlying error: {e}","messagePattern":"Could not decode audio for Riva STT\\. Convert your audio to wav/flac/ogg before calling the API\\. Underlying error: (.+?)","errorType":"exception","errorClass":"NvidiaRivaException","httpStatus":400,"severity":"error","filePath":"litellm/llms/nvidia_riva/audio_transcription/audio_utils.py","lineNumber":151,"sourceCode":"            with audioread.audio_open(tmp_path) as src:\n                source_rate = int(src.samplerate)\n                channels: Final = int(src.channels)\n                chunks: Final = []\n                for buf in src:\n                    chunks.append(np.frombuffer(buf, dtype=np.int16))\n                if not chunks:\n                    raise NvidiaRivaException(\n                        status_code=400,\n                        message=\"Audio decode produced no samples.\",\n                    )\n                interleaved = np.concatenate(chunks).astype(np.float32) / 32768.0\n                if channels > 1:\n                    interleaved = interleaved.reshape(-1, channels)\n                return cast(\"FloatArray\", interleaved), source_rate\n        except NvidiaRivaException:\n            raise\n        except Exception as e:\n            raise NvidiaRivaException(\n                status_code=400,\n                message=(\n                    \"Could not decode audio for Riva STT. Convert your audio to \"\n                    f\"wav/flac/ogg before calling the API. Underlying error: {e}\"\n                ),\n            ) from e\n    finally:\n        try:\n            os.unlink(tmp_path)\n        except OSError:\n            pass\n\n\ndef _resample(samples: \"FloatArray\", source_rate: int, target_rate: int) -> \"FloatArray\":\n    \"\"\"\n    Resample mono float32 ``samples`` from ``source_rate`` to ``target_rate``.\n\n    Prefers high-quality polyphase resampling when ``soxr`` or ``scipy`` is","sourceCodeStart":133,"sourceCodeEnd":169,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/nvidia_riva/audio_transcription/audio_utils.py#L133-L169","documentation":"Error \"Could not decode audio for Riva STT. Convert your audio to wav/flac/ogg before calling the API. Underlying error: {e}\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/llms/nvidia_riva/audio_transcription/audio_utils.py:151 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Convert your audio to wav/flac/ogg before calling the API; see the wrapped decode error {e}."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}