chenhg5/cc-connect · error

mimo tts API error

Error message

mimo tts API error: %s

What it means

MiMo TTS responded with HTTP 200 but the JSON payload carries an error object (result.Error with a message) — an application-level failure such as invalid voice, content policy, or quota. Surfaces the API's own error message.

Solutions

  1. Act on the embedded API message (auth, model name, quota)
  2. Retry only if the message indicates a transient condition
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at core/tts.go:514 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06). Data as JSON: /api/errors/a420db1e8272ac4b. Report an issue: GitHub.

Appendix: source

Thrown at core/tts.go:514

	var result struct {
		Choices []struct {
			Message struct {
				Audio struct {
					Data string `json:"data"`
				} `json:"audio"`
			} `json:"message"`
		} `json:"choices"`
		Error *struct {
			Message string `json:"message"`
			Type    string `json:"type"`
			Code    any    `json:"code"`
		} `json:"error"`
	}
	if err := json.Unmarshal(body, &result); err != nil {
		return nil, "", fmt.Errorf("mimo tts: parse response: %w", err)
	}
	if result.Error != nil && result.Error.Message != "" {
		return nil, "", fmt.Errorf("mimo tts API error: %s", result.Error.Message)
	}
	if len(result.Choices) == 0 || result.Choices[0].Message.Audio.Data == "" {
		return nil, "", fmt.Errorf("mimo tts: empty audio data in response")
	}

	audio, err := base64.StdEncoding.DecodeString(result.Choices[0].Message.Audio.Data)
	if err != nil {
		return nil, "", fmt.Errorf("mimo tts: decode audio base64: %w", err)
	}
	return audio, "wav", nil
}

// ──────────────────────────────────────────────────────────────
// EspeakTTS — Local eSpeak text-to-speech implementation
// ──────────────────────────────────────────────────────────────

// EspeakTTS implements TextToSpeech using the local espeak command.
type EspeakTTS struct {

View on GitHub (pinned to 4000b2338a)