BerriAI/litellm · error · NvidiaRivaException

Could not decode audio for Riva STT. Install audio extras…

Error message

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}

What it means

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.

Solutions

  1. Install audio extras with pip install 'litellm[stt-nvidia-riva]' so soundfile can decode the audio.
  2. Alternatively convert the audio to wav/flac/ogg before calling the API.

When it happens

Trigger: Thrown at litellm/llms/nvidia_riva/audio_transcription/audio_utils.py:115 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/0baafcdfad437d6e. Report an issue: GitHub.

Appendix: source

Thrown at litellm/llms/nvidia_riva/audio_transcription/audio_utils.py:115

    sf_error: Exception | None = None
    try:
        import soundfile as sf

        with io.BytesIO(file_bytes) as buf:
            data, source_rate = sf.read(buf, dtype="float32", always_2d=False)
        return cast("FloatArray", data), int(source_rate)
    except ImportError as e:
        sf_error = e
    except Exception as e:
        # soundfile raises RuntimeError / LibsndfileError for formats it
        # cannot decode (mp3 on older libsndfile, m4a, webm, ...).
        sf_error = e

    try:
        import audioread
    except ImportError as e:
        raise NvidiaRivaException(
            status_code=400,
            message=(
                "Could not decode audio for Riva STT. Install audio extras "
                f"(`pip install 'litellm[stt-nvidia-riva]'`) or convert your "
                f"audio to wav/flac/ogg before calling the API. "
                f"Underlying error: {sf_error}"
            ),
        ) from e

    # audioread backends (FFmpeg subprocess, GStreamer, Core Audio) require a
    # filesystem path, so spill the bytes to a temp file. mkstemp is portable
    # to Windows where re-opening a NamedTemporaryFile is not allowed.
    fd, tmp_path = tempfile.mkstemp(suffix=".audio")
    try:
        with os.fdopen(fd, "wb") as tmp_file:
            tmp_file.write(file_bytes)
        try:
            with audioread.audio_open(tmp_path) as src:

View on GitHub (pinned to 77b7c6c40c)