{"record":{"id":"0fab9d12417d6fbd","repo":"moeru-ai/airi","slug":"mimo-tts-request-failed-response-status-resp","errorCode":null,"errorMessage":"MiMo TTS request failed: ${response.status} ${response.statusText}","messagePattern":"MiMo TTS request failed: (.+?) (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/stage-ui/src/libs/providers/providers/mimo-audio/index.ts","lineNumber":111,"sourceCode":"        }\n\n        if (model === 'mimo-v2.5-tts-voicedesign' && !stylePrompt)\n          throw new Error('MiMo voice design requires a style prompt in the user message.')\n\n        const response = await fetch(new URL('chat/completions', baseUrl), {\n          method: 'POST',\n          headers: { 'Content-Type': 'application/json', 'api-key': apiKey },\n          body: JSON.stringify({\n            model,\n            messages: [\n              { role: 'user', content: userPrompt },\n              { role: 'assistant', content: body.input ?? '' },\n            ],\n            audio,\n          }),\n        })\n        if (!response.ok || !response.body)\n          throw new Error(`MiMo TTS request failed: ${response.status} ${response.statusText}`)\n\n        const data = await response.json() as {\n          choices?: Array<{ message?: { audio?: { data?: string } } }>\n        }\n        const audioBase64 = data.choices?.[0]?.message?.audio?.data\n        if (!audioBase64)\n          throw new Error('MiMo TTS response missing audio data')\n\n        const binary = atob(audioBase64)\n        const bytes = new Uint8Array(binary.length)\n        for (let index = 0; index < binary.length; index++)\n          bytes[index] = binary.charCodeAt(index)\n\n        let contentType = `audio/${format}`\n        if (format === 'wav')\n          contentType = 'audio/wav'\n        else if (format === 'mp3')\n          contentType = 'audio/mpeg'","sourceCodeStart":93,"sourceCodeEnd":129,"githubUrl":"https://github.com/moeru-ai/airi/blob/677329427f32468c74b17f3ec47eeca4e05bec65/packages/stage-ui/src/libs/providers/providers/mimo-audio/index.ts#L93-L129","documentation":"The POST to {baseUrl}/chat/completions for MiMo TTS returned a non-OK status or an empty body; the message embeds status and statusText (statusText can be empty on HTTP/2, leaving only the code). Authentication uses the api-key header, so key problems are the leading cause, followed by model and quota errors.","triggerScenarios":"Missing or invalid api-key (401/403); a model id not served by this deployment (400/404); rate limit or quota (429); baseUrl pointing at a gateway route that does not proxy chat/completions (404/502).","commonSituations":"Key expired or revoked; environment config drifted between stages; a gateway in front of MiMo changed its routes; a deployment without audio-capable models.","solutions":["Check the embedded status: 401/403 re-enter the API key; 429 back off; 404 fix baseUrl or model","Confirm baseUrl reaches the MiMo gateway and appends chat/completions correctly","Verify the model id is one of the mimo-v2.5-tts family","Inspect the request in devtools — statusText alone may be empty"],"exampleFix":"// before\nheaders: { 'api-key': '' } // empty key reaches the server → 401\n\n// after\nif (!apiKey?.trim()) throw new Error('MiMo API key is required')\nheaders: { 'Content-Type': 'application/json', 'api-key': apiKey }","handlingStrategy":"try-catch","validationCode":"if (!apiKey?.trim() || !URL.canParse(baseUrl))\n  throw new Error('MiMo provider is not configured') // fail before the request","typeGuard":null,"tryCatchPattern":"try {\n  const audio = await mimoSpeech(body)\n}\ncatch (err) {\n  const [, status] = err.message.match(/MiMo TTS request failed: (\\d+)/) ?? []\n  if (status === '401' || status === '403') promptForApiKey()\n  else if (status === '429') await backoffRetry()\n}","preventionTips":["Require a non-empty api-key in provider settings before enabling","Validate baseUrl with URL parsing at save time","Keep the model allowlist aligned with the deployment"],"tags":["mimo","tts","api","http","api-key"],"backgroundTag":"api-request-failed","analyzedSha":"677329427f32468c74b17f3ec47eeca4e05bec65","analyzedAt":"2026-08-18T17:29:58.153Z","schemaVersion":2},"datasetVersion":"2026-08-23T16:17:53.355Z"}