moeru-ai/airi · error · Error

MiMo voice design requires a style prompt in the user messag

Error message

MiMo voice design requires a style prompt in the user message.

What it means

When the request selects mimo-v2.5-tts-voicedesign, the provider needs a non-empty stylePrompt (body.style_prompt trimmed, falling back to config.stylePrompt) describing the desired voice; it throws client-side before the HTTP call when neither is provided. Plain mimo-v2.5-tts requests do not require a style prompt.

Source

Thrown at packages/stage-ui/src/libs/providers/providers/mimo-audio/index.ts:96

        const format = body.response_format || defaultFormat
        const stylePrompt = body.style_prompt?.trim() || config.stylePrompt?.trim() || ''
        const voiceSample = body.voice_sample?.trim() || config.voiceSample?.trim() || ''
        const userPrompt = model === 'mimo-v2.5-tts-voiceclone'
          ? stylePrompt
          : stylePrompt || 'Use a natural, clear speaking style.'

        const audio: Record<string, string> = { format }
        if (model === 'mimo-v2.5-tts-voiceclone') {
          if (!voiceSample)
            throw new Error('MiMo voice clone requires a base64 audio sample in data URI format.')
          audio.voice = voiceSample
        }
        else if (model === 'mimo-v2.5-tts') {
          audio.voice = body.voice || defaultVoice
        }

        if (model === 'mimo-v2.5-tts-voicedesign' && !stylePrompt)
          throw new Error('MiMo voice design requires a style prompt in the user message.')

        const response = await fetch(new URL('chat/completions', baseUrl), {
          method: 'POST',
          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 } } }>

View on GitHub (pinned to 677329427f)

Solutions

  1. Provide a descriptive style_prompt, or save stylePrompt in provider settings — e.g. 'A warm middle-aged male voice, calm pace'
  2. Use mimo-v2.5-tts if no style description is available
  3. Mark the style field required when design mode is selected

Example fix

// before
speech({ model: 'mimo-v2.5-tts-voicedesign', input: text }) // no style_prompt → throw

// after
speech({ model: 'mimo-v2.5-tts-voicedesign', input: text, style_prompt: 'A calm, warm female voice, medium pace' })
Defensive patterns

Strategy: validation

Validate before calling

if (model === 'mimo-v2.5-tts-voicedesign' && !(stylePrompt ?? '').trim())
  requireStylePrompt() // block the request before it is built

Try / catch

try {
  await synthesize(text, { model, style_prompt: style })
}
catch (err) {
  if (err.message.includes('style prompt'))
    focusStylePromptField()
}

Prevention

When it happens

Trigger: Design model chosen but the user submitted an empty or whitespace-only style prompt; the style prompt was configured only for a different model's settings; the UI passes the description inside `input` instead of style_prompt.

Common situations: A form allows submitting design mode with an empty style field; prompt text stored under the wrong field name; whitespace input reducing to nothing after trim.

Understand the failure class

Background: Missing required parameter errors: what 'X is required' and 'the required X param is missing' mean, and how to fix them — this error's family across 27 libraries.

Related errors


AI-assisted analysis of moeru-ai/airi@677329427f (2026-08-18). Data as JSON: /api/errors/bb53d29069977728. Report an issue: GitHub.