{"record":{"id":"faf9269e6fa84ab9","repo":"BerriAI/litellm","slug":"failed-to-decode-audio-data-e","errorCode":null,"errorMessage":"Failed to decode audio data: {e}","messagePattern":"Failed to decode audio data: (.+?)","errorType":"exception","errorClass":"MinimaxException","httpStatus":500,"severity":"error","filePath":"litellm/llms/minimax/text_to_speech/transformation.py","lineNumber":354,"sourceCode":"            audio_hex: Final = data.get(\"audio\", \"\") or response_json.get(\"audio_file\", \"\")\n\n            if not audio_hex:\n                raise MinimaxException(\n                    status_code=500,\n                    message=f\"No audio data in MiniMax response. Response keys: {list(response_json.keys())}\",\n                    headers=dict(raw_response.headers),\n                )\n\n            # MiniMax returns hex-encoded audio by default\n            # Try hex decoding first, fall back to base64 if that fails\n            try:\n                audio_bytes = bytes.fromhex(audio_hex)\n            except ValueError:\n                # If hex decoding fails, try base64 (for older API versions)\n                try:\n                    audio_bytes = base64.b64decode(audio_hex)\n                except Exception as e:\n                    raise MinimaxException(\n                        status_code=500,\n                        message=f\"Failed to decode audio data: {e}\",\n                        headers=dict(raw_response.headers),\n                    )\n\n            # Create a new response with binary audio content\n            # We need to create a response that contains the decoded audio bytes\n            # Remove gzip encoding headers to avoid decompression issues\n            clean_headers: Final = dict(raw_response.headers)\n            clean_headers.pop(\"content-encoding\", None)\n            clean_headers.pop(\"transfer-encoding\", None)\n            clean_headers[\"content-length\"] = str(len(audio_bytes))\n\n            # Create a new response object with the binary content\n            binary_response: Final = httpx.Response(\n                status_code=200,\n                headers=clean_headers,\n                content=audio_bytes,","sourceCodeStart":336,"sourceCodeEnd":372,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/llms/minimax/text_to_speech/transformation.py#L336-L372","documentation":"Error \"Failed to decode audio data: {e}\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/llms/minimax/text_to_speech/transformation.py:354 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["The audio data could not be decoded; check the output format."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}