chenhg5/cc-connect · error
http get: %w
Error message
http get: %w
What it means
downloadAudio failed at the second stage: the plain HTTP GET of the resolved downloadURL failed. This is a transport-level error (connection refused, DNS failure, TLS problem, timeout) reported via the injected httpClient.
Source
Thrown at platform/dingtalk/dingtalk.go:652
Data: fileBytes,
FileName: fileName,
}},
}
p.handler(p, msg)
}
func (p *Platform) downloadAudio(downloadCode string) ([]byte, string, error) {
// Get download URL
downloadURL, err := p.getDownloadURL(downloadCode)
if err != nil {
return nil, "", fmt.Errorf("get download URL: %w", err)
}
// Download audio file
resp, err := p.httpClient.Get(downloadURL)
if err != nil {
return nil, "", fmt.Errorf("http get: %w", err)
}
defer func() { _ = resp.Body.Close() }()
if resp.StatusCode != http.StatusOK {
return nil, "", fmt.Errorf("download returned status %d", resp.StatusCode)
}
data, err := io.ReadAll(resp.Body)
if err != nil {
return nil, "", fmt.Errorf("read response: %w", err)
}
// Determine MIME type from Content-Type header
mimeType := resp.Header.Get("Content-Type")
if mimeType == "" {
mimeType = "audio/amr" // Default to AMR if not specified
}
View on GitHub (pinned to 4000b2338a)
Solutions
- Check outbound network connectivity and proxy settings on the host.
- Re-download promptly — the DingTalk download URL is short-lived; if delayed, fetch a fresh URL via getDownloadURL.
- Confirm the download URL scheme is https and not corrupted by the webhook payload.
- If cause is a timeout, increase the httpClient timeout or retry once.
Defensive patterns
Strategy: retry
Validate before calling
// Pre-check connectivity at startup:
resp, err := http.Get("https://download.dingtalk.com") // or any DingTalk host
if err != nil { log.Fatal("no outbound access to DingTalk CDN: ", err) }
resp.Body.Close() Try / catch
if err != nil {
if errors.Is(err, context.DeadlineExceeded) { /* timeout: increase or back off */ }
log.Warn("audio download failed (network)", "err", err)
return retryOnce()
} Prevention
- Download immediately after receiving the message — URLs are short-lived
- Configure a sane httpClient timeout
- Ensure outbound HTTPS is allowed through proxies/firewalls
When it happens
Trigger: p.httpClient.Get(downloadURL) returned a non-nil error while downloading the audio file bytes from the URL obtained from DingTalk.
Common situations: Host has no outbound internet access or a broken proxy; the short-lived download URL already expired (some CDNs then drop connections); DNS misconfiguration; TLS certificate issues in restricted environments.
Understand the failure class
Background: 'Something went wrong' / 'Request failed (500)' / 'HTTP error! status: 404' — what failed HTTP requests actually mean and how to find the real cause — this error's family across 28 libraries.
Related errors
AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06).
Data as JSON: /api/errors/9779fadb2d8bdc21.
Report an issue: GitHub.