BerriAI/litellm · error · MinimaxException

Failed to decode audio data: {e}

Error message

Failed to decode audio data: {e}

What it means

Error "Failed to decode audio data: {e}" thrown in BerriAI/litellm.

Source

Thrown at litellm/llms/minimax/text_to_speech/transformation.py:354

            audio_hex: Final = data.get("audio", "") or response_json.get("audio_file", "")

            if not audio_hex:
                raise MinimaxException(
                    status_code=500,
                    message=f"No audio data in MiniMax response. Response keys: {list(response_json.keys())}",
                    headers=dict(raw_response.headers),
                )

            # MiniMax returns hex-encoded audio by default
            # Try hex decoding first, fall back to base64 if that fails
            try:
                audio_bytes = bytes.fromhex(audio_hex)
            except ValueError:
                # If hex decoding fails, try base64 (for older API versions)
                try:
                    audio_bytes = base64.b64decode(audio_hex)
                except Exception as e:
                    raise MinimaxException(
                        status_code=500,
                        message=f"Failed to decode audio data: {e}",
                        headers=dict(raw_response.headers),
                    )

            # Create a new response with binary audio content
            # We need to create a response that contains the decoded audio bytes
            # Remove gzip encoding headers to avoid decompression issues
            clean_headers: Final = dict(raw_response.headers)
            clean_headers.pop("content-encoding", None)
            clean_headers.pop("transfer-encoding", None)
            clean_headers["content-length"] = str(len(audio_bytes))

            # Create a new response object with the binary content
            binary_response: Final = httpx.Response(
                status_code=200,
                headers=clean_headers,
                content=audio_bytes,

View on GitHub (pinned to 6c2dcb801b)

Solutions

  1. The audio data could not be decoded; check the output format.

When it happens

Trigger: Thrown at litellm/llms/minimax/text_to_speech/transformation.py:354 when the library encounters an invalid state.

Common situations: See trigger scenarios.

Understand the failure class


AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15). Data as JSON: /api/errors/faf9269e6fa84ab9. Report an issue: GitHub.