{"record":{"id":"816ae92fe74b5107","repo":"decolua/9router","slug":"minimax-tts-upstream-error","errorCode":null,"errorMessage":"MiniMax TTS upstream error","messagePattern":"MiniMax TTS upstream error","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"open-sse/handlers/ttsProviders/minimax.js","lineNumber":52,"sourceCode":"      },\n    }),\n  });\n\n  const rawText = await res.text();\n  let data = {};\n  if (rawText) {\n    try { data = JSON.parse(rawText); } catch { data = {}; }\n  }\n\n  const baseResp = data.base_resp || data.baseResp || {};\n  const statusCode = Number(baseResp.status_code ?? baseResp.statusCode ?? 0);\n  const statusMessage = baseResp.status_msg || baseResp.statusMsg || data.message || \"\";\n\n  if (!res.ok) {\n    throw new Error(statusMessage || rawText || `MiniMax TTS error (${res.status})`);\n  }\n  if (statusCode !== 0) {\n    throw new Error(statusMessage || \"MiniMax TTS upstream error\");\n  }\n\n  return {\n    base64: hexToBase64(data.data?.audio),\n    format: data.extra_info?.audio_format || data.extraInfo?.audioFormat || \"mp3\",\n  };\n}\n","sourceCodeStart":34,"sourceCodeEnd":60,"githubUrl":"https://github.com/decolua/9router/blob/90b52e06ffd666b7929554211474d01588f6b1f8/open-sse/handlers/ttsProviders/minimax.js#L34-L60","documentation":"9Router's MiniMax TTS provider throws this when the upstream MiniMax HTTP response is OK (200) but the JSON body's base_resp.status_code is non-zero, meaning MiniMax rejected the request at the application level. The status_msg field from MiniMax is preferred but if empty this generic message is thrown. It signals an API-level refusal (auth, quota, invalid params) rather than a transport failure.","triggerScenarios":"Calling the TTS endpoint with a MiniMax API key that is invalid/expired (status 1000/1004), exceeding group quota, or an invalid model/voice — any response where HTTP 200 is returned but baseResp.statusCode !== 0 and status_msg is empty.","commonSituations":"Developers using a MiniMax international key against the China endpoint (or vice versa), exhausted free trial credits, or a group_id mismatch in the configured base URL.","solutions":["Log the full MiniMax response body to see base_resp.status_code and status_msg for the real cause","Verify the MiniMax API key is valid and belongs to the correct group (intl vs cn endpoint)","Check remaining quota/credits in the MiniMax console","Confirm the TTS model and voice names are valid for your account tier","If status_msg was empty, patch error handling to include the numeric status_code in the thrown message"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const status = body?.base_resp?.status_code ?? body?.baseResp?.statusCode;\nif (typeof status === \"number\" && status !== 0) {\n  throw new Error(`MiniMax TTS rejected: ${status} ${body?.base_resp?.status_msg ?? \"\"}`);\n}","typeGuard":"function hasMiniMaxAudio(d) {\n  return typeof d?.data?.audio === \"string\" && d.data.audio.length > 0;\n}","tryCatchPattern":"try {\n  const out = await minimaxTts(text, opts);\n} catch (e) {\n  if (/MiniMax/.test(e.message)) {\n    logger.warn(\"minimax tts rejected\", e.message);\n    // surface base_resp.status_msg / switch provider\n  } else throw e;\n}","preventionTips":["Validate the MiniMax key and group/endpoint pairing (intl vs cn) before routing TTS there","Monitor quota in the MiniMax console and alert before exhaustion","Include base_resp.status_code in logs for every TTS call","Configure a fallback TTS provider"],"tags":["tts","minimax","upstream-error","api-key"],"backgroundTag":"upstream-provider-error","analyzedSha":"90b52e06ffd666b7929554211474d01588f6b1f8","analyzedAt":"2026-08-30T21:05:45.952Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}