{"record":{"id":"ac215211765610b5","repo":"chenhg5/cc-connect","slug":"whisper-request-w","errorCode":null,"errorMessage":"whisper request: %w","messagePattern":"whisper request: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/speech.go","lineNumber":86,"sourceCode":"\t}\n\t_ = writer.WriteField(\"model\", w.Model)\n\t_ = writer.WriteField(\"response_format\", \"text\")\n\tif lang != \"\" {\n\t\t_ = writer.WriteField(\"language\", lang)\n\t}\n\twriter.Close()\n\n\turl := w.BaseURL + \"/audio/transcriptions\"\n\treq, err := http.NewRequestWithContext(ctx, http.MethodPost, url, &buf)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"create request: %w\", err)\n\t}\n\treq.Header.Set(\"Authorization\", \"Bearer \"+w.APIKey)\n\treq.Header.Set(\"Content-Type\", writer.FormDataContentType())\n\n\tresp, err := w.Client.Do(req)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"whisper 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 \"\", fmt.Errorf(\"read response: %w\", err)\n\t}\n\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn \"\", fmt.Errorf(\"whisper API %d: %s\", resp.StatusCode, string(body))\n\t}\n\n\t// response_format=text returns plain text; try to handle JSON fallback\n\ttext := strings.TrimSpace(string(body))\n\tif strings.HasPrefix(text, \"{\") {\n\t\tvar jr struct {\n\t\t\tText string `json:\"text\"`\n\t\t}","sourceCodeStart":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/core/speech.go#L68-L104","documentation":"The HTTP POST to the Whisper /audio/transcriptions endpoint failed at the transport level: the client could not complete the request. Common wrapped causes are DNS failure, connection refused, TLS errors, and context deadline/cancellation (the client has a 5-minute timeout).","triggerScenarios":"Transcribe called when the network is down, the BaseURL host is unreachable or wrong, a proxy blocks the request, TLS cert validation fails, the 5-minute http.Client timeout elapses, or the request context is cancelled.","commonSituations":"No internet access or corporate proxy required; firewall blocking api.openai.com; self-hosted Whisper (e.g. Groq/localai) endpoint down or wrong port; DNS misconfiguration; user cancels voice transcription.","solutions":["Verify network connectivity and that the BaseURL host is reachable (curl the endpoint)","Check whether a proxy is required and configure http.Client Transport accordingly","If the wrapped error is 'context deadline exceeded', increase the client timeout or investigate slow uploads","Confirm the self-hosted/proxy ASR service is running and the port is correct"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// pre-check connectivity\nreq, _ := http.NewRequestWithContext(ctx, http.MethodGet, baseURL, nil)\nif _, err := client.Do(req); err != nil {\n    return fmt.Errorf(\"ASR endpoint unreachable: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"var netErr net.Error\nif errors.As(err, &netErr) && netErr.Timeout() {\n    // retry with backoff or enlarge client timeout\n}\nif errors.Is(err, context.Canceled) {\n    // user aborted: do not retry\n}","preventionTips":["Configure proxy settings (HTTP_PROXY/HTTPS_PROXY) where required","Keep the 5-minute client timeout but monitor for timeout-heavy workloads","Health-check the ASR endpoint at startup (cc-connect doctor)","Use retries with exponential backoff for transient transport failures"],"tags":["network","http","timeout","whisper"],"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-14T00:17:10.932Z"}