{"record":{"id":"0e2ed9c66b251e59","repo":"chenhg5/cc-connect","slug":"mimo-tts-request-w","errorCode":null,"errorMessage":"mimo tts: request: %w","messagePattern":"mimo tts: request: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/tts.go","lineNumber":484,"sourceCode":"\t\t},\n\t}\n\tjsonData, err := json.Marshal(reqBody)\n\tif err != nil {\n\t\treturn nil, \"\", fmt.Errorf(\"mimo tts: marshal request: %w\", err)\n\t}\n\n\turl := strings.TrimRight(m.BaseURL, \"/\") + \"/chat/completions\"\n\treq, err := http.NewRequestWithContext(ctx, http.MethodPost, url, bytes.NewReader(jsonData))\n\tif err != nil {\n\t\treturn nil, \"\", fmt.Errorf(\"mimo tts: create request: %w\", err)\n\t}\n\t// MiMo authenticates via \"api-key\" header, not \"Authorization: Bearer\".\n\treq.Header.Set(\"api-key\", m.APIKey)\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\tresp, err := m.Client.Do(req)\n\tif err != nil {\n\t\treturn nil, \"\", fmt.Errorf(\"mimo tts: request: %w\", err)\n\t}\n\tdefer resp.Body.Close()\n\n\tbody, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn nil, \"\", fmt.Errorf(\"mimo tts: read response: %w\", err)\n\t}\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn nil, \"\", fmt.Errorf(\"mimo tts API %d: %s\", resp.StatusCode, body)\n\t}\n\n\tvar result struct {\n\t\tChoices []struct {\n\t\t\tMessage struct {\n\t\t\t\tAudio struct {\n\t\t\t\t\tData string `json:\"data\"`\n\t\t\t\t} `json:\"audio\"`\n\t\t\t} `json:\"message\"`","sourceCodeStart":466,"sourceCodeEnd":502,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/core/tts.go#L466-L502","documentation":"This error wraps m.Client.Do(req) failing for the MiMo TTS call to /chat/completions — the HTTP round-trip itself failed, so no response exists. Causes include DNS failure, connection refused, TLS errors, and context cancellation or deadline exceeded in flight.","triggerScenarios":"MiMo endpoint unreachable (wrong host, service down); DNS failure; TLS handshake problem; ctx deadline exceeded during the request; network interruption.","commonSituations":"No outbound internet in container/CI; misconfigured mimo base_url in config.toml; proxy required but not set; client timeout too short for WAV synthesis.","solutions":["Test connectivity to the MiMo host directly (curl -v) from the same host.","Unwrap the error: context.DeadlineExceeded → raise the timeout; connection refused → fix base_url or wait for service recovery.","Set/verify HTTPS_PROXY if the environment requires a proxy for egress.","Retry with backoff for transient network failures."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"if u, err := url.Parse(cfg.BaseURL); err != nil || u.Host == \"\" { return fmt.Errorf(\"invalid mimo base_url\") }","typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"mimo tts: request:\") {\n    if errors.Is(err, context.DeadlineExceeded) {\n        // extend timeout\n    } else if isConnectionRefused(err) {\n        // endpoint down: check base_url / wait for recovery\n    }\n}","preventionTips":["Health-check the MiMo endpoint at startup","Configure proxy env vars where egress requires them","Use generous client timeouts for WAV synthesis","Apply retry with exponential backoff around Synthesize"],"tags":["go","network","http","tts","mimo"],"backgroundTag":"network-request-failed","analyzedSha":"4000b2338aa6e850c99df54f8b0ed6ed7460b401","analyzedAt":"2026-09-06T11:45:09.575Z","contentChangedAt":"2026-09-06T11:45:09.575Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}