chenhg5/cc-connect · error

mimo tts: read response: %w

Error message

mimo tts: read response: %w

What it means

DingTalk downloadAudio: the media-download endpoint returned a non-200 status when fetching the audio file referenced by the message's downloadCode, so the voice bytes are never retrieved and the audio message is dropped.

Source

Thrown at core/tts.go:490

	url := strings.TrimRight(m.BaseURL, "/") + "/chat/completions"
	req, err := http.NewRequestWithContext(ctx, http.MethodPost, url, bytes.NewReader(jsonData))
	if err != nil {
		return nil, "", fmt.Errorf("mimo tts: create request: %w", err)
	}
	// MiMo authenticates via "api-key" header, not "Authorization: Bearer".
	req.Header.Set("api-key", m.APIKey)
	req.Header.Set("Content-Type", "application/json")

	resp, err := m.Client.Do(req)
	if err != nil {
		return nil, "", fmt.Errorf("mimo tts: request: %w", err)
	}
	defer resp.Body.Close()

	body, err := io.ReadAll(resp.Body)
	if err != nil {
		return nil, "", fmt.Errorf("mimo tts: read response: %w", err)
	}
	if resp.StatusCode != http.StatusOK {
		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"`

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Retry synthesis; check network stability/proxy to the MiMo host
  2. Verify BaseURL is reachable and not dropping large responses
Defensive patterns

Strategy: retry

When it happens

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