{"record":{"id":"0baafcdfad437d6e","repo":"BerriAI/litellm","slug":"could-not-decode-audio-for-riva-stt-install-audio","errorCode":null,"errorMessage":"Could not decode audio for Riva STT. Install audio extras (`pip install 'litellm[stt-nvidia-riva]'`) or convert your audio to wav/flac/ogg before calling the API. Underlying error: {sf_error}","messagePattern":"Could not decode audio for Riva STT\\. Install audio extras \\(`pip install 'litellm\\[stt-nvidia-riva\\]'`\\) or 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":115,"sourceCode":"\n    sf_error: Exception | None = None\n    try:\n        import soundfile as sf\n\n        with io.BytesIO(file_bytes) as buf:\n            data, source_rate = sf.read(buf, dtype=\"float32\", always_2d=False)\n        return cast(\"FloatArray\", data), int(source_rate)\n    except ImportError as e:\n        sf_error = e\n    except Exception as e:\n        # soundfile raises RuntimeError / LibsndfileError for formats it\n        # cannot decode (mp3 on older libsndfile, m4a, webm, ...).\n        sf_error = e\n\n    try:\n        import audioread\n    except ImportError as e:\n        raise NvidiaRivaException(\n            status_code=400,\n            message=(\n                \"Could not decode audio for Riva STT. Install audio extras \"\n                f\"(`pip install 'litellm[stt-nvidia-riva]'`) or convert your \"\n                f\"audio to wav/flac/ogg before calling the API. \"\n                f\"Underlying error: {sf_error}\"\n            ),\n        ) from e\n\n    # audioread backends (FFmpeg subprocess, GStreamer, Core Audio) require a\n    # filesystem path, so spill the bytes to a temp file. mkstemp is portable\n    # to Windows where re-opening a NamedTemporaryFile is not allowed.\n    fd, tmp_path = tempfile.mkstemp(suffix=\".audio\")\n    try:\n        with os.fdopen(fd, \"wb\") as tmp_file:\n            tmp_file.write(file_bytes)\n        try:\n            with audioread.audio_open(tmp_path) as src:","sourceCodeStart":97,"sourceCodeEnd":133,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/nvidia_riva/audio_transcription/audio_utils.py#L97-L133","documentation":"Error \"Could not decode audio for Riva STT. Install audio extras (`pip install 'litellm[stt-nvidia-riva]'`) or convert your audio to wav/flac/ogg before calling the API. Underlying error: {sf_error}\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/llms/nvidia_riva/audio_transcription/audio_utils.py:115 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Install audio extras with pip install 'litellm[stt-nvidia-riva]' so soundfile can decode the audio.","Alternatively convert the audio to wav/flac/ogg before calling the API."],"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"}