{"record":{"id":"797b15ea65259d5f","repo":"harry0703/MoneyPrinterTurbo","slug":"mimo-tts-returned-empty-audio-data","errorCode":null,"errorMessage":"MiMo TTS returned empty audio data","messagePattern":"MiMo TTS returned empty audio data","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"app/services/voice.py","lineNumber":1291,"sourceCode":"                audio={\n                    \"format\": \"wav\",\n                    \"voice\": voice_name,\n                },\n            )\n\n            if not completion or not getattr(completion, \"choices\", None):\n                raise ValueError(\"MiMo TTS returned empty response\")\n\n            message = completion.choices[0].message\n            audio = getattr(message, \"audio\", None)\n            audio_data = None\n            if isinstance(audio, dict):\n                audio_data = audio.get(\"data\")\n            elif audio is not None:\n                audio_data = getattr(audio, \"data\", None)\n\n            if not audio_data:\n                raise ValueError(\"MiMo TTS returned empty audio data\")\n\n            audio_bytes = base64.b64decode(audio_data)\n            audio_segment = AudioSegment.from_file(io.BytesIO(audio_bytes), format=\"wav\")\n\n            output_format = utils.parse_extension(voice_file) or \"mp3\"\n            if output_format == \"wav\":\n                with open(voice_file, \"wb\") as f:\n                    f.write(audio_bytes)\n            else:\n                audio_segment.export(voice_file, format=output_format)\n\n            audio_duration = len(audio_segment) / 1000.0\n            sub_maker = ensure_legacy_submaker_fields(SubMaker())\n            logger.success(f\"mimo tts succeeded: {voice_file}\")\n            logger.debug(\n                \"mimo subtitle timeline generated, \"\n                f\"duration: {audio_duration:.3f}s, output_format: {output_format}\"\n            )","sourceCodeStart":1273,"sourceCodeEnd":1309,"githubUrl":"https://github.com/harry0703/MoneyPrinterTurbo/blob/1f9f19c2021a68d04df228f33e9099a0c947f6f8/app/services/voice.py#L1273-L1309","documentation":"Raised after a successful MiMo completion when the message's audio payload is missing or empty. The code accepts either a dict (audio['data']) or an object attribute (audio.data); if neither yields truthy data, it raises. So the model responded with choices but without base64 audio bytes.","triggerScenarios":"Calling MiMo TTS where the model replies with text only (no audio generated); requesting a voice_name the model does not support, so it falls back to a non-audio answer; API changes the audio field shape so both dict and attribute extraction miss.","commonSituations":"Invalid or deprecated voice name in the 'mimo:' config; audio output disabled for the account/model; SDK/model version where the audio payload shape changed; empty input text after stripping.","solutions":["Confirm the voice name after 'mimo:' is one the model actually supports for audio output.","Ensure the request includes audio: {format: 'wav', voice: voice_name} and a non-empty assistant text.","Log getattr(message, 'audio', None) when debugging to see the actual payload shape returned by the API.","Retry once — some deployments intermittently return text-only completions."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if not voice_name or not voice_name.strip():\n    raise ValueError(\"MiMo audio requires a non-empty voice name\")","typeGuard":null,"tryCatchPattern":"try:\n    ...  # call MiMo TTS\nexcept ValueError as exc:\n    msg = str(exc)\n    if \"empty audio data\" in msg:\n        # model answered without audio: check voice name / audio params, retry once\n        ...\n    raise","preventionTips":["Use only voice names documented as audio-capable for the MiMo model.","Always send audio={'format': 'wav', 'voice': ...}; omitting it yields text-only answers."],"tags":["tts","mimo","api","audio-data"],"backgroundTag":null,"analyzedSha":"1f9f19c2021a68d04df228f33e9099a0c947f6f8","analyzedAt":"2026-08-14T19:41:05.568Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}