chenhg5/cc-connect · error

minimax tts: no audio data received

Error message

minimax tts: no audio data received

What it means

After the SSE stream ends cleanly, Synthesize checks that at least one audio byte was decoded; this error fires when the stream produced zero audio. MiniMax accepted the request (HTTP 200, status_code 0) but sent no audio chunks — often an empty/blank result (e.g. empty input text, only a status=2 trailer with no data, or an unusual stream shape).

Source

Thrown at core/tts.go:405

		// chunks; the final status=2 chunk re-sends the full audio as a
		// trailer for non-stream clients. Appending the trailer doubles the
		// audio length and makes the spoken text play twice, so skip it.
		if chunk.Data.Status == 2 {
			break
		}
		if chunk.Data.Audio != "" {
			audioBytes, err := hex.DecodeString(chunk.Data.Audio)
			if err != nil {
				return nil, "", fmt.Errorf("minimax tts: decode audio hex: %w", err)
			}
			audioBuf.Write(audioBytes)
		}
	}
	if err := scanner.Err(); err != nil {
		return nil, "", fmt.Errorf("minimax tts: read SSE stream: %w", err)
	}
	if audioBuf.Len() == 0 {
		return nil, "", fmt.Errorf("minimax tts: no audio data received")
	}
	return audioBuf.Bytes(), "mp3", nil
}

// ──────────────────────────────────────────────────────────────
// MimoTTS — Xiaomi MiMo-V2.5-TTS implementation
// ──────────────────────────────────────────────────────────────

// MimoTTS implements TextToSpeech using the Xiaomi MiMo-V2.5-TTS API,
// which is shaped like OpenAI chat completions: the synthesis text rides
// on an assistant message and audio bytes come back base64-encoded inside
// choices[0].message.audio.data.
//
// Docs: https://platform.xiaomimimo.com/#/docs/usage-guide/speech-synthesis
type MimoTTS struct {
	APIKey  string
	BaseURL string
	Model   string

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Guard at the call site: skip Synthesize when the text to speak is empty or whitespace-only.
  2. Log/inspect the raw SSE stream to confirm whether MiniMax really sent no chunks.
  3. Upgrade/verify the client matches the current T2A v2 protocol (status 1 = incremental, status 2 = trailer).
  4. Retry once; if MiniMax intermittently returns empty streams, add a fallback TTS provider if configured.

Example fix

// before
tts.Synthesize(ctx, text, voice)
// after
if strings.TrimSpace(text) == "" { return nil } // don't call TTS with empty text
Defensive patterns

Strategy: validation

Validate before calling

if strings.TrimSpace(text) == "" { return errors.New("tts: cannot synthesize empty text") }

Try / catch

if err != nil && strings.Contains(err.Error(), "no audio data received") {
    // skip speaking, fall back to text-only reply, or retry once
}

Prevention

When it happens

Trigger: Input text is empty or only whitespace so MiniMax emits no audio chunks; stream ends after status=1 chunk(s) with empty audio fields; API version returns a payload shape where all audio fields are blank.

Common situations: Caller passes an empty string to TTS (e.g. blank commit message or summary); MiniMax degrades a response under load; mismatch between client expectations and a newer/older MiniMax stream protocol.

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 chenhg5/cc-connect@4000b2338a (2026-09-06). Data as JSON: /api/errors/ede40051f85886c4. Report an issue: GitHub.