chenhg5/cc-connect · error

mimo tts: parse response: %w

Error message

mimo tts: parse response: %w

What it means

JSON unmarshal of the MiMo TTS API response body failed: the server returned a body that is not valid JSON or does not match the expected choices/message/audio envelope (e.g. HTML error page, empty body, truncated response).

Source

Thrown at core/tts.go:511

		return nil, "", fmt.Errorf("mimo tts API %d: %s", resp.StatusCode, body)
	}

	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
// ──────────────────────────────────────────────────────────────

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Confirm BaseURL points at the chat/completions-compatible TTS route
  2. Check for a proxy/gateway returning HTML errors
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at core/tts.go:511 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/27a58892b2663ea6. Report an issue: GitHub.