moeru-ai/airi · error

MiMo TTS response missing audio data

Error message

MiMo TTS response missing audio data

What it means

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.

Solutions

  1. Log the full response JSON to inspect choices, finish reason, and any error fields
  2. Verify the endpoint/model actually returns audio output (audio modality enabled)
  3. Check whether the input text was blocked by content policy and adjust it
  4. Handle the empty-audio case in caller code with a clear user-facing error
  5. Re-check the MiMo API docs for response schema changes and update parsing
Defensive patterns

Strategy: try-catch

Validate before calling

// no client-side check can prevent this; ensure input text is non-empty and policy-safe
if (!input?.trim()) return null

Type guard

function hasAudioData(data: unknown): data is { choices: Array<{ message: { audio: { data: string } } }> } {
  const d = data as any
  return Boolean(d?.choices?.[0]?.message?.audio?.data)
}

Try / catch

try {
  const audio = await speech({ input, model })
} catch (e) {
  if (e instanceof Error && e.message === 'MiMo TTS response missing audio data') {
    // inspect the raw response for refusal/block reasons and inform the user
  }
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "empty response", "returned no data", "empty embeddings": what HTTP 200-with-empty-body errors mean across libraries — this error's family across 36 libraries.

Related errors


AI-assisted analysis of moeru-ai/airi@438a067dde (2026-09-08). Data as JSON: /api/errors/0d060f266e324428. Report an issue: GitHub.

Appendix: source

Thrown at packages/provider-inference/src/providers/cloud/mimo-audio/index.ts:120

          headers: { 'Content-Type': 'application/json', 'api-key': apiKey },
          body: JSON.stringify({
            model,
            messages: [
              { role: 'user', content: userPrompt },
              { role: 'assistant', content: body.input ?? '' },
            ],
            audio,
          }),
        })
        if (!response.ok || !response.body)
          throw new Error(`MiMo TTS request failed: ${response.status} ${response.statusText}`)

        const data = await response.json() as {
          choices?: Array<{ message?: { audio?: { data?: string } } }>
        }
        const audioBase64 = data.choices?.[0]?.message?.audio?.data
        if (!audioBase64)
          throw new Error('MiMo TTS response missing audio data')

        const binary = atob(audioBase64)
        const bytes = new Uint8Array(binary.length)
        for (let index = 0; index < binary.length; index++)
          bytes[index] = binary.charCodeAt(index)

        let contentType = `audio/${format}`
        if (format === 'wav')
          contentType = 'audio/wav'
        else if (format === 'mp3')
          contentType = 'audio/mpeg'

        return new Response(bytes.buffer, {
          status: 200,
          headers: { 'Content-Type': contentType },
        })
      },
    }),

View on GitHub (pinned to 438a067dde)