chenhg5/cc-connect · error
get_bot_qrcode: %w
Error message
get_bot_qrcode: %w
What it means
weixinFetchBotQRCode calls weixinHTTPGet against the ilink `get_bot_qrcode` endpoint; if that HTTP request fails (including the non-200 http %d error from [481]), it wraps the failure with this `get_bot_qrcode:` prefix. The wrapped error chain retains the status code and body snippet from the inner error.
Source
Thrown at cmd/cc-connect/weixin.go:436
if len(s) <= max {
return s
}
return s[:max] + "…"
}
func weixinFetchBotQRCode(ctx context.Context, apiBase, botType, routeTag string, debug bool) (*weixinBotQRResponse, error) {
base := strings.TrimRight(apiBase, "/") + "/"
u, err := url.Parse(base)
if err != nil {
return nil, err
}
u = u.JoinPath("ilink", "bot", "get_bot_qrcode")
q := u.Query()
q.Set("bot_type", botType)
u.RawQuery = q.Encode()
raw, err := weixinHTTPGet(ctx, u.String(), routeTag, debug)
if err != nil {
return nil, fmt.Errorf("get_bot_qrcode: %w", err)
}
var out weixinBotQRResponse
if err := json.Unmarshal(raw, &out); err != nil {
return nil, fmt.Errorf("get_bot_qrcode json: %w", err)
}
return &out, nil
}
func weixinPollQRStatus(ctx context.Context, apiBase, qrKey, routeTag string, debug bool) (*weixinQRStatusResponse, error) {
base := strings.TrimRight(apiBase, "/") + "/"
u, err := url.Parse(base)
if err != nil {
return nil, err
}
u = u.JoinPath("ilink", "bot", "get_qrcode_status")
q := u.Query()
q.Set("qrcode", qrKey)
u.RawQuery = q.Encode()View on GitHub (pinned to 4000b2338a)
Solutions
- Inspect the wrapped cause (%w chain) for the HTTP status and body snippet
- Confirm api_base and bot_type are valid for your WeChat bot setup
- Test the endpoint manually with curl using the same URL and query parameters
- Retry if the cause indicates a transient 5xx/429 response
Defensive patterns
Strategy: retry
Try / catch
qr, err := weixinFetchBotQRCode(ctx, apiBase, botType, routeTag, debug)
if err != nil {
var transient bool
var he *weixinHTTPError
if errors.As(err, &he) { transient = he.Status == 429 || he.Status >= 500 }
if transient { /* retry with backoff */ } else { return err }
} Prevention
- Confirm api_base and bot_type values before setup
- Retry only transient (429/5xx) failures
- Test the endpoint manually with curl first
- Monitor ilink service status during incidents
When it happens
Trigger: runWeixinQRLoginFlow requests a bot QR code and the GET to `ilink/bot/get_bot_qrcode` returns a network error or a non-200 HTTP status.
Common situations: Incorrect api_base in the weixin config; bot_type query value rejected by the server; offline machine or blocked network; ilink service incident.
Understand the failure class
Background: "API request failed": what wrapped HTTP errors from external APIs mean and how to find the real cause — this error's family across 29 libraries.
Related errors
- http %d: %s
- get_qrcode_status http %d: %s
- weixin: %s: %w
- weixin: %s: read body: %w
- range chunk retries exhausted
AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06).
Data as JSON: /api/errors/9955e916be7a2bd6.
Report an issue: GitHub.