{"record":{"id":"8c06317c664bfa36","repo":"harry0703/MoneyPrinterTurbo","slug":"minimax-get-voice-failed-with-status-response-sta","errorCode":null,"errorMessage":"MiniMax get_voice failed with status {response.status_code}: {response.text[:200]}","messagePattern":"MiniMax get_voice failed with status (.+?): (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"app/services/voice.py","lineNumber":1411,"sourceCode":"        if endpoint\n        else get_minimax_tts_endpoint()\n    )\n    voice_endpoint = (\n        f\"{tts_endpoint[:-len('/t2a_v2')]}/get_voice\"\n        if tts_endpoint.endswith(\"/t2a_v2\")\n        else f\"{tts_endpoint.rstrip('/')}/get_voice\"\n    )\n    response = requests.post(\n        voice_endpoint,\n        json={\"voice_type\": voice_type},\n        headers={\n            \"Authorization\": f\"Bearer {effective_api_key}\",\n            \"Content-Type\": \"application/json\",\n        },\n        timeout=30,\n    )\n    if response.status_code != 200:\n        raise RuntimeError(\n            f\"MiniMax get_voice failed with status {response.status_code}: \"\n            f\"{response.text[:200]}\"\n        )\n\n    try:\n        body = response.json()\n    except ValueError as exc:\n        raise RuntimeError(\"MiniMax get_voice returned invalid JSON\") from exc\n\n    base_resp = body.get(\"base_resp\") or {}\n    if base_resp.get(\"status_code\") not in {0, \"0\"}:\n        status_message = str(base_resp.get(\"status_msg\") or \"unknown error\")\n        raise RuntimeError(f\"MiniMax get_voice failed: {status_message}\")\n\n    catalog = []\n    seen_voice_ids = set()\n    response_groups = (\n        (\"system\", \"system_voice\"),","sourceCodeStart":1393,"sourceCodeEnd":1429,"githubUrl":"https://github.com/harry0703/MoneyPrinterTurbo/blob/1f9f19c2021a68d04df228f33e9099a0c947f6f8/app/services/voice.py#L1393-L1429","documentation":"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).","triggerScenarios":"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.","commonSituations":"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.","solutions":["Read the embedded response text — it names the exact upstream reason for the status code.","For 401/403, refresh the MiniMax API key in configuration.","For 404, verify the configured TTS endpoint ends with /t2a_v2 so the get_voice URL is derived correctly.","For 429/5xx, retry with backoff before failing."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    voices = list_minimax_voices(voice_type=vt)\nexcept RuntimeError as exc:\n    msg = str(exc)\n    if \"status 429\" in msg or \"status 5\" in msg:\n        time.sleep(backoff); return list_minimax_voices(voice_type=vt)  # transient\n    raise  # 401/403/404 are config problems — surface the embedded body text","preventionTips":["Keep the MiniMax endpoint config ending in /t2a_v2 so the get_voice URL derives correctly.","Treat 401/403 as key-rotation events and alert rather than retry-loop."],"tags":["minimax","tts","http","api"],"backgroundTag":null,"analyzedSha":"1f9f19c2021a68d04df228f33e9099a0c947f6f8","analyzedAt":"2026-08-14T19:41:05.568Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}