MiniMax-AI/skills · error · SystemExit

No audio in response: {json.dumps(data, indent=2)}

Error message

No audio in response: {json.dumps(data, indent=2)}

What it means

Defensive guard: t2a_v2 returned base_resp.status_code 0 (no API error) but data.data.audio is empty/missing, so there are no bytes to decode from hex. The full JSON is dumped for inspection.

Source

Thrown at skills/frontend-dev/scripts/minimax_tts.py:85

        f"{API_BASE}/t2a_v2",
        headers={
            "Authorization": f"Bearer {API_KEY}",
            "Content-Type": "application/json",
        },
        json=payload,
        timeout=timeout,
    )
    resp.raise_for_status()
    data = resp.json()

    # Check API-level error
    base_resp = data.get("base_resp", {})
    if base_resp.get("status_code", 0) != 0:
        raise SystemExit(f"API Error [{base_resp.get('status_code')}]: {base_resp.get('status_msg')}")

    audio_hex = data.get("data", {}).get("audio", "")
    if not audio_hex:
        raise SystemExit(f"No audio in response: {json.dumps(data, indent=2)}")

    return bytes.fromhex(audio_hex)


def main():
    p = argparse.ArgumentParser(description="MiniMax Sync TTS (HTTP)")
    p.add_argument("text", help="Text to synthesize (max 10000 chars)")
    p.add_argument("-o", "--output", required=True, help="Output file path")
    p.add_argument("-v", "--voice", default="male-qn-qingse", help="Voice ID")
    p.add_argument("--model", default="speech-2.8-hd", help="Model (default: speech-2.8-hd)")
    p.add_argument("--speed", type=float, default=1.0, help="Speed 0.5-2.0")
    p.add_argument("--volume", type=float, default=1.0, help="Volume 0.1-10")
    p.add_argument("--pitch", type=int, default=0, help="Pitch -12 to 12")
    p.add_argument("--emotion", default="", help="Emotion tag (happy/sad/angry/...)")
    p.add_argument("--format", default="mp3", dest="fmt", help="Audio format (mp3/wav/flac)")
    p.add_argument("--sample-rate", type=int, default=32000, help="Sample rate")
    p.add_argument("--lang", default="auto", help="Language boost")
    args = p.parse_args()

View on GitHub (pinned to 60aaae52bb)

Solutions

  1. Retry the identical request once — empty-audio-on-success is usually transient.
  2. Inspect the dumped JSON to confirm where audio actually lives.
  3. Try a different format/sample_rate to see if the field populates.
  4. If reproducible, capture the JSON and report with model/region since success+empty-audio violates the expected contract.

Example fix

// before: trust data.audio is present
audio_hex = data.get("data", {}).get("audio", "")
return bytes.fromhex(audio_hex)

// after: guard + single retry
audio_hex = data.get("data", {}).get("audio", "")
if not audio_hex:
    data = post(payload)  # one retry
    audio_hex = data.get("data", {}).get("audio", "")
if not audio_hex:
    raise RuntimeError("TTS returned no audio after retry")
return bytes.fromhex(audio_hex)
Defensive patterns

Strategy: retry

Validate before calling

def extract_tts_audio(data: dict):
    """Return audio hex from plausible locations, or None."""
    for path in (("data", "audio"), ("audio",), ("data", "audio_hex")):
        v = data
        for k in path:
            v = v.get(k, {}) if isinstance(v, dict) else None
        if v:
            return v
    return None

Type guard

def has_tts_audio(data: dict) -> bool:
    """True when a success TTS response carries audio bytes."""
    return bool(extract_tts_audio(data))

Try / catch

for attempt in range(2):
    data = call_tts_api(payload)
    if data.get("base_resp", {}).get("status_code", 0) == 0:
        audio = extract_tts_audio(data)
        if audio:
            return bytes.fromhex(audio)
    time.sleep(3)
raise RuntimeError("TTS returned no audio after retry")

Prevention

When it happens

Trigger: A success-shaped TTS response with an absent audio field — rare backend issue, an output_format the endpoint populated differently, or a response schema that diverged from the assumed `data.audio` hex location.

Common situations: Transient backend serialization hiccup; account/model combination that doesn't fully populate audio in hex mode; API version that relocated the field; intermittent empty payload under load.

Related errors


AI-assisted analysis of MiniMax-AI/skills@60aaae52bb (2026-08-13). Data as JSON: /api/errors/09130687f811d4ae. Report an issue: GitHub.