{"record":{"id":"f55569e395ef3f93","repo":"BerriAI/litellm","slug":"error-processing-minimax-response-e","errorCode":null,"errorMessage":"Error processing MiniMax response: {e}","messagePattern":"Error processing MiniMax response: (.+?)","errorType":"exception","errorClass":"MinimaxException","httpStatus":500,"severity":"error","filePath":"litellm/llms/minimax/text_to_speech/transformation.py","lineNumber":387,"sourceCode":"            binary_response: Final = httpx.Response(\n                status_code=200,\n                headers=clean_headers,\n                content=audio_bytes,\n                request=raw_response.request,\n            )\n\n            return HttpxBinaryResponseContent(binary_response)\n\n        except json.JSONDecodeError as e:\n            raise MinimaxException(\n                status_code=500,\n                message=f\"Failed to parse MiniMax response: {e}\",\n                headers=dict(raw_response.headers),\n            )\n        except Exception as e:\n            if isinstance(e, MinimaxException):\n                raise\n            raise MinimaxException(\n                status_code=500,\n                message=f\"Error processing MiniMax response: {e}\",\n                headers=dict(raw_response.headers),\n            )\n\n    def get_complete_url(\n        self,\n        model: str,\n        api_base: str | None,\n        litellm_params: dict,\n    ) -> str:\n        \"\"\"\n        Construct the MiniMax endpoint URL.\n        \"\"\"\n        base_url = api_base or get_secret_str(\"MINIMAX_API_BASE\") or self.TTS_BASE_URL\n        base_url = base_url.rstrip(\"/\")\n\n        # MiniMax uses a simple endpoint path","sourceCodeStart":369,"sourceCodeEnd":405,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/llms/minimax/text_to_speech/transformation.py#L369-L405","documentation":"A catch-all raised by the MiniMax TTS response transformer when any unexpected exception (other than a MinimaxException or JSONDecodeError) escapes while building HttpxBinaryResponseContent from the upstream response. It wraps the original exception in a MinimaxException (HTTP 500) with the upstream headers, preserving the error text in the message.","triggerScenarios":"MiniMax TTS call succeeds at HTTP level but processing fails: audio bytes are empty/corrupt so constructing the httpx.Response or HttpxBinaryResponseContent fails, header cleaning raises, or an environment/dependency issue (e.g. httpx version incompatibility) surfaces during response assembly.","commonSituations":"Empty audio returned by upstream (bad voice/model combination, zero-length input text), a misbehaving intermediary that strips the audio body, or litellm/httpx version drift changing Response construction semantics.","solutions":["Inspect the wrapped message — it embeds the original exception text which names the real cause.","Verify the TTS request params (voice, model, non-empty input text) so upstream actually returns audio bytes.","Update litellm (and httpx) to the latest patch release in case response-construction code changed.","If behind a corporate proxy, bypass it for the MiniMax domain to rule out body mangling.","Reproduce with litellm.set_verbose=True to capture the full upstream response before the failure."],"exampleFix":"# before\naudio = litellm.text_to_speech(model=\"minimax/tts-01\", input=text)\n\n# after — validate inputs that commonly yield empty/bad audio\nif not text.strip():\n    raise ValueError(\"input text must be non-empty for MiniMax TTS\")\naudio = litellm.text_to_speech(model=\"minimax/tts-01\", input=text, voice=voice_id)","handlingStrategy":"try-catch","validationCode":"if not isinstance(text, str) or not text.strip():\n    raise ValueError(\"TTS input must be non-empty text\")","typeGuard":null,"tryCatchPattern":"from litellm.exceptions import APIError\ntry:\n    audio = litellm.text_to_speech(model=\"minimax/tts-02-hd-preview\", input=text)\nexcept APIError as e:\n    log.exception(\"MiniMax TTS response processing failed: %s\", e)  # message embeds root cause\n    raise","preventionTips":["Keep litellm and httpx versions aligned with the project's lockfile.","Reject empty input text before calling.","Capture the embedded original exception text in logs for diagnosis."],"tags":["minimax","text-to-speech","wrapper-exception","audio"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}