chenhg5/cc-connect · error
qwen asr request: %w
Error message
qwen asr request: %w
What it means
The HTTP POST to the Qwen ASR chat/completions endpoint failed at the transport level. Wrapped causes include DNS failure, connection refused, TLS errors, proxy interference, the 5-minute client timeout, or context cancellation.
Source
Thrown at core/speech.go:173
},
}
jsonData, err := json.Marshal(reqBody)
if err != nil {
return "", fmt.Errorf("marshal request: %w", err)
}
url := q.BaseURL + "/chat/completions"
req, err := http.NewRequestWithContext(ctx, http.MethodPost, url, bytes.NewReader(jsonData))
if err != nil {
return "", fmt.Errorf("create request: %w", err)
}
req.Header.Set("Authorization", "Bearer "+q.APIKey)
req.Header.Set("Content-Type", "application/json")
resp, err := q.Client.Do(req)
if err != nil {
return "", fmt.Errorf("qwen asr 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("qwen asr API %d: %s", resp.StatusCode, string(body))
}
var result struct {
Choices []struct {
Message struct {
Content string `json:"content"`
} `json:"message"`
} `json:"choices"`View on GitHub (pinned to 4000b2338a)
Solutions
- Verify the endpoint is reachable: curl https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions
- Check proxy/firewall/region restrictions for DashScope access
- If the wrapped error is a timeout, shorten audio or raise the http.Client timeout
- Confirm the custom base_url host/port if using a gateway
Defensive patterns
Strategy: retry
Validate before calling
// verify reachability before use
resp, err := http.Head(q.BaseURL)
if err != nil {
return fmt.Errorf("dashscope endpoint unreachable: %w", err)
}
resp.Body.Close() Try / catch
var netErr net.Error
if errors.As(err, &netErr) && netErr.Timeout() {
// shorten audio or raise client timeout, then retry
}
if errors.Is(err, context.Canceled) {
// caller cancelled; do not retry
} Prevention
- Confirm DashScope reachability from your deployment region/network
- Configure HTTPS_PROXY where corporate egress is required
- Retry transient transport errors with backoff
- Check gateway host/port when overriding base_url
When it happens
Trigger: Transcribe called when the DashScope endpoint is unreachable (no network, wrong base_url host/port, blocked region, TLS interception), when the request exceeds the 5-minute timeout, or when ctx is cancelled.
Common situations: Deployments outside mainland China hitting DashScope connectivity issues; corporate proxy/firewall blocking dashscope.aliyuncs.com; typo'd custom gateway URL pointing to a dead host; long audio making the request exceed timeouts.
Related errors
AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06).
Data as JSON: /api/errors/f49eef722bb61bbf.
Report an issue: GitHub.