{"record":{"id":"0d060f266e324428","repo":"moeru-ai/airi","slug":"mimo-tts-response-missing-audio-data-0d060f","errorCode":null,"errorMessage":"MiMo TTS response missing audio data","messagePattern":"MiMo TTS response missing audio data","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/provider-inference/src/providers/cloud/mimo-audio/index.ts","lineNumber":120,"sourceCode":"          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'\n\n        return new Response(bytes.buffer, {\n          status: 200,\n          headers: { 'Content-Type': contentType },\n        })\n      },\n    }),","sourceCodeStart":102,"sourceCodeEnd":138,"githubUrl":"https://github.com/moeru-ai/airi/blob/438a067dde47aa0bdb46c2323d1fe293dc805218/packages/provider-inference/src/providers/cloud/mimo-audio/index.ts#L102-L138","documentation":"The MiMo endpoint returned a successful response whose message contained no audio.data base64 payload. The provider cannot construct audio bytes from the response and throws instead of returning empty output.","triggerScenarios":"The chat/completions response parsed successfully but choices[0].message.audio.data is missing or empty: generation refused/blocked, model returned text-only output, or the API response schema changed.","commonSituations":"Content policy blocking synthesis of the input text, requesting audio from a non-audio-enabled model/endpoint, or MiMo changing the audio field placement in responses.","solutions":["Log the full response JSON to inspect choices, finish reason, and any error fields","Verify the endpoint/model actually returns audio output (audio modality enabled)","Check whether the input text was blocked by content policy and adjust it","Handle the empty-audio case in caller code with a clear user-facing error","Re-check the MiMo API docs for response schema changes and update parsing"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// no client-side check can prevent this; ensure input text is non-empty and policy-safe\nif (!input?.trim()) return null","typeGuard":"function hasAudioData(data: unknown): data is { choices: Array<{ message: { audio: { data: string } } }> } {\n  const d = data as any\n  return Boolean(d?.choices?.[0]?.message?.audio?.data)\n}","tryCatchPattern":"try {\n  const audio = await speech({ input, model })\n} catch (e) {\n  if (e instanceof Error && e.message === 'MiMo TTS response missing audio data') {\n    // inspect the raw response for refusal/block reasons and inform the user\n  }\n}","preventionTips":["Confirm the endpoint/model returns audio modality output","Avoid input text likely to be blocked by content policy","Log raw responses to detect schema drift in the audio field","Surface empty-audio as a distinct user-facing state rather than a silent failure"],"tags":["tts","empty-response","mimo"],"backgroundTag":"empty-api-response","analyzedSha":"438a067dde47aa0bdb46c2323d1fe293dc805218","analyzedAt":"2026-09-08T13:18:15.005Z","contentChangedAt":"2026-09-08T13:18:15.005Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}