harry0703/MoneyPrinterTurbo · error · ValueError

MiMo TTS returned empty audio data

Error message

MiMo TTS returned empty audio data

What it means

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.

Source

Thrown at app/services/voice.py:1291

                audio={
                    "format": "wav",
                    "voice": voice_name,
                },
            )

            if not completion or not getattr(completion, "choices", None):
                raise ValueError("MiMo TTS returned empty response")

            message = completion.choices[0].message
            audio = getattr(message, "audio", None)
            audio_data = None
            if isinstance(audio, dict):
                audio_data = audio.get("data")
            elif audio is not None:
                audio_data = getattr(audio, "data", None)

            if not audio_data:
                raise ValueError("MiMo TTS returned empty audio data")

            audio_bytes = base64.b64decode(audio_data)
            audio_segment = AudioSegment.from_file(io.BytesIO(audio_bytes), format="wav")

            output_format = utils.parse_extension(voice_file) or "mp3"
            if output_format == "wav":
                with open(voice_file, "wb") as f:
                    f.write(audio_bytes)
            else:
                audio_segment.export(voice_file, format=output_format)

            audio_duration = len(audio_segment) / 1000.0
            sub_maker = ensure_legacy_submaker_fields(SubMaker())
            logger.success(f"mimo tts succeeded: {voice_file}")
            logger.debug(
                "mimo subtitle timeline generated, "
                f"duration: {audio_duration:.3f}s, output_format: {output_format}"
            )

View on GitHub (pinned to 1f9f19c202)

Solutions

  1. Confirm the voice name after 'mimo:' is one the model actually supports for audio output.
  2. Ensure the request includes audio: {format: 'wav', voice: voice_name} and a non-empty assistant text.
  3. Log getattr(message, 'audio', None) when debugging to see the actual payload shape returned by the API.
  4. Retry once — some deployments intermittently return text-only completions.
Defensive patterns

Strategy: validation

Validate before calling

if not voice_name or not voice_name.strip():
    raise ValueError("MiMo audio requires a non-empty voice name")

Try / catch

try:
    ...  # call MiMo TTS
except ValueError as exc:
    msg = str(exc)
    if "empty audio data" in msg:
        # model answered without audio: check voice name / audio params, retry once
        ...
    raise

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of harry0703/MoneyPrinterTurbo@1f9f19c202 (2026-08-14). Data as JSON: /api/errors/797b15ea65259d5f. Report an issue: GitHub.