chenhg5/cc-connect · error

whisper request: %w

Error message

whisper request: %w

What it means

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).

Source

Thrown at core/speech.go:86

	}
	_ = writer.WriteField("model", w.Model)
	_ = writer.WriteField("response_format", "text")
	if lang != "" {
		_ = writer.WriteField("language", lang)
	}
	writer.Close()

	url := w.BaseURL + "/audio/transcriptions"
	req, err := http.NewRequestWithContext(ctx, http.MethodPost, url, &buf)
	if err != nil {
		return "", fmt.Errorf("create request: %w", err)
	}
	req.Header.Set("Authorization", "Bearer "+w.APIKey)
	req.Header.Set("Content-Type", writer.FormDataContentType())

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

	body, err := io.ReadAll(resp.Body)
	if err != nil {
		return "", fmt.Errorf("read response: %w", err)
	}

	if resp.StatusCode != http.StatusOK {
		return "", fmt.Errorf("whisper API %d: %s", resp.StatusCode, string(body))
	}

	// response_format=text returns plain text; try to handle JSON fallback
	text := strings.TrimSpace(string(body))
	if strings.HasPrefix(text, "{") {
		var jr struct {
			Text string `json:"text"`
		}

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Verify network connectivity and that the BaseURL host is reachable (curl the endpoint)
  2. Check whether a proxy is required and configure http.Client Transport accordingly
  3. If the wrapped error is 'context deadline exceeded', increase the client timeout or investigate slow uploads
  4. Confirm the self-hosted/proxy ASR service is running and the port is correct
Defensive patterns

Strategy: retry

Validate before calling

// pre-check connectivity
req, _ := http.NewRequestWithContext(ctx, http.MethodGet, baseURL, nil)
if _, err := client.Do(req); err != nil {
    return fmt.Errorf("ASR endpoint unreachable: %w", err)
}

Try / catch

var netErr net.Error
if errors.As(err, &netErr) && netErr.Timeout() {
    // retry with backoff or enlarge client timeout
}
if errors.Is(err, context.Canceled) {
    // user aborted: do not retry
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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