{"record":{"id":"bb53d29069977728","repo":"moeru-ai/airi","slug":"mimo-voice-design-requires-a-style-prompt-in-the-u","errorCode":null,"errorMessage":"MiMo voice design requires a style prompt in the user message.","messagePattern":"MiMo voice design requires a style prompt in the user message\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/stage-ui/src/libs/providers/providers/mimo-audio/index.ts","lineNumber":96,"sourceCode":"        const format = body.response_format || defaultFormat\n        const stylePrompt = body.style_prompt?.trim() || config.stylePrompt?.trim() || ''\n        const voiceSample = body.voice_sample?.trim() || config.voiceSample?.trim() || ''\n        const userPrompt = model === 'mimo-v2.5-tts-voiceclone'\n          ? stylePrompt\n          : stylePrompt || 'Use a natural, clear speaking style.'\n\n        const audio: Record<string, string> = { format }\n        if (model === 'mimo-v2.5-tts-voiceclone') {\n          if (!voiceSample)\n            throw new Error('MiMo voice clone requires a base64 audio sample in data URI format.')\n          audio.voice = voiceSample\n        }\n        else if (model === 'mimo-v2.5-tts') {\n          audio.voice = body.voice || defaultVoice\n        }\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 } } }>","sourceCodeStart":78,"sourceCodeEnd":114,"githubUrl":"https://github.com/moeru-ai/airi/blob/677329427f32468c74b17f3ec47eeca4e05bec65/packages/stage-ui/src/libs/providers/providers/mimo-audio/index.ts#L78-L114","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Provide a descriptive style_prompt, or save stylePrompt in provider settings — e.g. 'A warm middle-aged male voice, calm pace'","Use mimo-v2.5-tts if no style description is available","Mark the style field required when design mode is selected"],"exampleFix":"// before\nspeech({ model: 'mimo-v2.5-tts-voicedesign', input: text }) // no style_prompt → throw\n\n// after\nspeech({ model: 'mimo-v2.5-tts-voicedesign', input: text, style_prompt: 'A calm, warm female voice, medium pace' })","handlingStrategy":"validation","validationCode":"if (model === 'mimo-v2.5-tts-voicedesign' && !(stylePrompt ?? '').trim())\n  requireStylePrompt() // block the request before it is built","typeGuard":null,"tryCatchPattern":"try {\n  await synthesize(text, { model, style_prompt: style })\n}\ncatch (err) {\n  if (err.message.includes('style prompt'))\n    focusStylePromptField()\n}","preventionTips":["Disable the design-mode submit button until style_prompt is non-empty","Offer placeholder examples to guide valid style descriptions","Persist the last used style prompt per user"],"tags":["mimo","tts","voice-design","validation","precondition"],"backgroundTag":"missing-required-parameter","analyzedSha":"677329427f32468c74b17f3ec47eeca4e05bec65","analyzedAt":"2026-08-18T17:29:58.153Z","schemaVersion":2},"datasetVersion":"2026-08-23T16:17:53.355Z"}