{"record":{"id":"e8f3e0ab3aa8c735","repo":"moeru-ai/airi","slug":"mimo-tts-request-failed-response-status-resp-e8f3e0","errorCode":null,"errorMessage":"MiMo TTS request failed: ${response.status} ${response.statusText}","messagePattern":"MiMo TTS request failed: (.+?) (.+?)","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/provider-inference/src/providers/cloud/mimo-audio/index.ts","lineNumber":113,"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":95,"sourceCodeEnd":131,"githubUrl":"https://github.com/moeru-ai/airi/blob/f679616c34f1cf6d282c8d64264242af944b3fed/packages/provider-inference/src/providers/cloud/mimo-audio/index.ts#L95-L131","documentation":"The MiMo chat/completions-based TTS endpoint returned a non-OK status, or returned OK with no response body. The provider raises a single error carrying the HTTP status and statusText so the developer can diagnose the API-side rejection.","triggerScenarios":"MiMo API rejects the request: invalid api-key header, unknown model id, malformed audio options, quota/auth failures, or a 5xx outage; also when response.ok but response.body is null.","commonSituations":"Wrong or missing API key, using a MiMo model id not available to the account, incorrect baseUrl pointing at a non-MiMo endpoint, or transient server errors.","solutions":["Check the status/statusText in the message; 401/403 means fix the API key, 404 means check model id and baseUrl","Verify the 'api-key' header value and that baseUrl points to the correct MiMo endpoint","Confirm the TTS model id (mimo-v2.5-tts / voiceclone / voicedesign) is enabled for your account","Retry with backoff on 429/5xx","Ensure a response body is present (the provider also rejects OK-with-no-body responses)"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// pre-flight\nif (!apiKey) throw new Error('Missing MiMo api-key')\nif (!/^https?:\\/\\//.test(baseUrl)) throw new Error('Invalid MiMo baseUrl')","typeGuard":null,"tryCatchPattern":"try {\n  const audio = await speech({ input, model })\n} catch (e) {\n  if (e instanceof Error && e.message.startsWith('MiMo TTS request failed:')) {\n    const status = Number(e.message.match(/failed: (\\d+)/)?.[1])\n    if (status === 429 || status >= 500) await retryWithBackoff()\n    else if (status === 401 || status === 403) fixApiKey()\n    else if (status === 404) fixModelOrBaseUrl()\n  }\n}","preventionTips":["Verify the api-key header and baseUrl point to the MiMo deployment","Confirm the model id is enabled for your account","Retry only transient statuses (429/5xx) with backoff","Keep the status code parsing centralized for consistent handling"],"tags":["tts","http","api-error","mimo"],"backgroundTag":"http-error-response","analyzedSha":"f679616c34f1cf6d282c8d64264242af944b3fed","analyzedAt":"2026-09-08T13:18:15.005Z","contentChangedAt":"2026-09-08T13:18:15.005Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}