sipeed/picoclaw · error
download media returned HTTP
Error message
download media returned HTTP %d
What it means
Returned by storeRemoteMedia when the media download request completed but the WeCom server answered with a non-200 status (the %d shows the code). Common causes: expired media URL (WeCom media links are short-lived), auth failure (400/401), or server errors (5xx).
Solutions
- For 400/401: the media link or access token expired — re-fetch the media URL with a fresh access token before downloading
- For 5xx/429: retry after backoff, WeCom endpoints are rate limited
- Download media promptly after receiving the message instead of much later, since links expire
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at pkg/channels/wecom/media.go:294 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of sipeed/picoclaw@49183d7e8d (2026-08-15).
Data as JSON: /api/errors/7966fc0083d3d788.
Report an issue: GitHub.
Appendix: source
Thrown at pkg/channels/wecom/media.go:294
ctx context.Context,
scope, msgID, resourceURL, aesKey, fallbackExt string,
) (string, error) {
store := c.GetMediaStore()
if store == nil {
return "", fmt.Errorf("no media store available")
}
req, err := http.NewRequestWithContext(ctx, http.MethodGet, resourceURL, nil)
if err != nil {
return "", fmt.Errorf("create request: %w", err)
}
resp, err := c.mediaClient.Do(req)
if err != nil {
return "", fmt.Errorf("download media: %w", err)
}
defer resp.Body.Close()
if resp.StatusCode != http.StatusOK {
return "", fmt.Errorf("download media returned HTTP %d", resp.StatusCode)
}
data, err := io.ReadAll(io.LimitReader(resp.Body, wecomOutboundMediaMaxBytes+1))
if err != nil {
return "", fmt.Errorf("read media: %w", err)
}
if len(data) > wecomOutboundMediaMaxBytes {
return "", fmt.Errorf("media too large")
}
if aesKey != "" {
key, keyErr := decodeMediaAESKey(aesKey)
if keyErr != nil {
return "", keyErr
}
data, err = decryptAESCBC(key, data)
if err != nil {
return "", fmt.Errorf("decrypt media: %w", err)View on GitHub (pinned to 49183d7e8d)