moeru-ai/airi · error · Error

MiniMax TTS request failed: ${response.status} ${response.st

Error message

MiniMax TTS request failed: ${response.status} ${response.statusText}

What it means

Thrown by the MiniMax speech provider when the TTS request to the MiniMax API returns a non-OK status or a response without a body. At this point the HTTP call itself failed (auth, quota, invalid model/voice) — the SSE hex-audio-chunk parsing that follows never runs. Only `status` and `statusText` are reported; MiniMo-style error bodies are not included.

Source

Thrown at packages/stage-ui/src/libs/providers/providers/minimax-speech/index.ts:61

              text: body.input ?? '',
              stream: true,
              voice_setting: {
                voice_id: body.voice || 'English_Graceful_Lady',
                speed: 1,
                vol: 1,
                pitch: 0,
              },
              audio_setting: {
                sample_rate: 32000,
                bitrate: 128000,
                format: 'mp3',
                channel: 1,
              },
            }),
          })

          if (!response.ok || !response.body)
            throw new Error(`MiniMax TTS request failed: ${response.status} ${response.statusText}`)

          // MiniMax streams SSE events that contain hex-encoded audio chunks.
          const reader = response.body.getReader()
          const decoder = new TextDecoder()
          const audioChunks: Uint8Array[] = []
          let buffer = ''

          while (true) {
            const { done, value } = await reader.read()
            if (done)
              break

            buffer += decoder.decode(value, { stream: true })
            const lines = buffer.split('\n')
            buffer = lines.pop() || ''
            for (const line of lines) {
              if (!line.startsWith('data:'))
                continue

View on GitHub (pinned to 677329427f)

Solutions

  1. Check `response.status` in the message: 401/403 → re-enter the MiniMax API key; 400 → verify model and voice_id; 429/5xx → quota or outage, retry later.
  2. Confirm the base URL host matches the account region (minimax.chat vs minimaxi.com).
  3. Verify the configured voice id exists for the configured model in the MiniMax console.
  4. If status is 200 but body is missing, bypass or reconfigure the proxy so SSE streams pass through unbuffered.

Example fix

// before
if (!response.ok || !response.body)
  throw new Error(`MiniMax TTS request failed: ${response.status} ${response.statusText}`)
// after — include the upstream error body for diagnosis
if (!response.ok || !response.body) {
  const errorBody = !response.ok ? await response.text().catch(() => '') : ''
  throw new Error(`MiniMax TTS request failed: ${response.status} ${response.statusText}${errorBody ? ` — ${errorBody}` : ''}`)
}
Defensive patterns

Strategy: try-catch

Validate before calling

if (!config.apiKey?.trim() || !config.groupId?.trim())
  throw new Error('MiniMax credentials are incomplete — check provider settings')

Try / catch

try {
  const audio = await minimaxTts(payload)
}
catch (error) {
  const message = errorMessageFrom(error)
  if (/401|403/.test(message))
    // refresh MiniMix credentials
  else if (/429|5\d\d/.test(message))
    // transient — back off and retry once
  else
    throw error
}

Prevention

When it happens

Trigger: POSTing the TTS payload (model, voice_id, audio_setting with sample_rate 32000 / mp3 / mono) and MiniMax answers 401 (invalid API key), 403 (unauthorized group), 400 (unknown voice_id or model name), 429 (rate/quota), or 5xx. Also triggered when a proxy strips the response body so `!response.body` holds even with status 200.

Common situations: API key or group id pasted incorrectly into provider settings; using a China-host (`api.minimax.chat`) key against the international host (`api.minimaxi.com`) or vice versa; voice id that belongs to a different model generation; account out of credits; corporate proxy buffering/removing the SSE body.

Related errors


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