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
- Retry the identical request once — empty-audio-on-success is usually transient.
- Inspect the dumped JSON to confirm where audio actually lives.
- Try a different format/sample_rate to see if the field populates.
- 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
- Treat success+empty-audio as transient — retry once before reporting.
- Search alternate field locations in case the schema diverged.
- Log the full payload when audio is absent to catch schema drift.
- Try a different format/sample_rate if one mode yields empty audio.
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
- No audio in response: {json.dumps(data, indent=2)}
- API Error [{base_resp.get('status_code')}]: {base_resp.get('
- No task_id in response: {json.dumps(data, indent=2)}
- Task succeeded but no file_id returned
- No download_url in response: {json.dumps(data, indent=2)}
AI-assisted analysis of MiniMax-AI/skills@60aaae52bb (2026-08-13).
Data as JSON: /api/errors/09130687f811d4ae.
Report an issue: GitHub.