harry0703/MoneyPrinterTurbo · error · RuntimeError

MiniMax get_voice failed with status {response.status_code}:

Error message

MiniMax get_voice failed with status {response.status_code}: {response.text[:200]}

What it means

The POST to the MiniMax get_voice endpoint returned a non-200 HTTP status. The error embeds the status code plus the first 200 characters of the response body, which usually states the real cause (invalid key, bad voice_type, rate limit).

Source

Thrown at app/services/voice.py:1411

        if endpoint
        else get_minimax_tts_endpoint()
    )
    voice_endpoint = (
        f"{tts_endpoint[:-len('/t2a_v2')]}/get_voice"
        if tts_endpoint.endswith("/t2a_v2")
        else f"{tts_endpoint.rstrip('/')}/get_voice"
    )
    response = requests.post(
        voice_endpoint,
        json={"voice_type": voice_type},
        headers={
            "Authorization": f"Bearer {effective_api_key}",
            "Content-Type": "application/json",
        },
        timeout=30,
    )
    if response.status_code != 200:
        raise RuntimeError(
            f"MiniMax get_voice failed with status {response.status_code}: "
            f"{response.text[:200]}"
        )

    try:
        body = response.json()
    except ValueError as exc:
        raise RuntimeError("MiniMax get_voice returned invalid JSON") from exc

    base_resp = body.get("base_resp") or {}
    if base_resp.get("status_code") not in {0, "0"}:
        status_message = str(base_resp.get("status_msg") or "unknown error")
        raise RuntimeError(f"MiniMax get_voice failed: {status_message}")

    catalog = []
    seen_voice_ids = set()
    response_groups = (
        ("system", "system_voice"),

View on GitHub (pinned to 1f9f19c202)

Solutions

  1. Read the embedded response text — it names the exact upstream reason for the status code.
  2. For 401/403, refresh the MiniMax API key in configuration.
  3. For 404, verify the configured TTS endpoint ends with /t2a_v2 so the get_voice URL is derived correctly.
  4. For 429/5xx, retry with backoff before failing.
Defensive patterns

Strategy: retry

Try / catch

try:
    voices = list_minimax_voices(voice_type=vt)
except RuntimeError as exc:
    msg = str(exc)
    if "status 429" in msg or "status 5" in msg:
        time.sleep(backoff); return list_minimax_voices(voice_type=vt)  # transient
    raise  # 401/403/404 are config problems — surface the embedded body text

Prevention

When it happens

Trigger: Expired or revoked API key (401/403); malformed request JSON or unsupported voice_type (400); rate limiting or server issues (429/5xx); wrong endpoint base URL producing 404.

Common situations: Key rotated but config still holds the old one; custom endpoint override that does not follow the .../t2a_v2 suffix convention so the derived .../get_voice URL is wrong; hitting quota limits during bulk voice listing.

Related errors


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