BerriAI/litellm · error · NvidiaRivaException

Could not decode audio for Riva STT. Convert your audio to…

Error message

Could not decode audio for Riva STT. Convert your audio to wav/flac/ogg before calling the API. Underlying error: {e}

What it means

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.

Solutions

  1. Convert your audio to wav/flac/ogg before calling the API; see the wrapped decode error {e}.

When it happens

Trigger: Thrown at litellm/llms/nvidia_riva/audio_transcription/audio_utils.py:151 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/9c91c3d83c7aa40a. Report an issue: GitHub.

Appendix: source

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

            with audioread.audio_open(tmp_path) as src:
                source_rate = int(src.samplerate)
                channels: Final = int(src.channels)
                chunks: Final = []
                for buf in src:
                    chunks.append(np.frombuffer(buf, dtype=np.int16))
                if not chunks:
                    raise NvidiaRivaException(
                        status_code=400,
                        message="Audio decode produced no samples.",
                    )
                interleaved = np.concatenate(chunks).astype(np.float32) / 32768.0
                if channels > 1:
                    interleaved = interleaved.reshape(-1, channels)
                return cast("FloatArray", interleaved), source_rate
        except NvidiaRivaException:
            raise
        except Exception as e:
            raise NvidiaRivaException(
                status_code=400,
                message=(
                    "Could not decode audio for Riva STT. Convert your audio to "
                    f"wav/flac/ogg before calling the API. Underlying error: {e}"
                ),
            ) from e
    finally:
        try:
            os.unlink(tmp_path)
        except OSError:
            pass


def _resample(samples: "FloatArray", source_rate: int, target_rate: int) -> "FloatArray":
    """
    Resample mono float32 ``samples`` from ``source_rate`` to ``target_rate``.

    Prefers high-quality polyphase resampling when ``soxr`` or ``scipy`` is

View on GitHub (pinned to 77b7c6c40c)