chenhg5/cc-connect · warning
等待扫码超时,请重试
Error message
等待扫码超时,请重试
What it means
runWeixinQRLoginFlow polls the WeChat ilink QR-code login endpoint in a loop waiting for the user to scan the displayed QR code. If the loop exhausts its retry budget (each iteration sleeps one second) without the status endpoint reporting a scan/confirmation, the flow aborts with this Chinese message ('QR scan timed out, please retry') and returns a nil session. It is a deliberate timeout guard so the setup wizard does not hang forever on an abandoned login.
Source
Thrown at cmd/cc-connect/weixin.go:382
if strings.TrimSpace(status.IlinkBotID) == "" {
return nil, fmt.Errorf("login confirmed but ilink_bot_id missing")
}
if strings.TrimSpace(status.BotToken) == "" {
return nil, fmt.Errorf("login confirmed but bot_token missing")
}
fmt.Println("\n✅ 已与微信建立连接。")
return &weixinQRLoginResult{
BotToken: strings.TrimSpace(status.BotToken),
IlinkBotID: strings.TrimSpace(status.IlinkBotID),
BaseURL: strings.TrimSpace(status.BaseURL),
IlinkUserID: strings.TrimSpace(status.IlinkUserID),
}, nil
default:
time.Sleep(time.Second)
}
}
return nil, fmt.Errorf("等待扫码超时,请重试")
}
func weixinHTTPGet(ctx context.Context, fullURL, routeTag string, debug bool) ([]byte, error) {
req, err := http.NewRequestWithContext(ctx, http.MethodGet, fullURL, nil)
if err != nil {
return nil, err
}
if routeTag != "" {
req.Header.Set("SKRouteTag", routeTag)
}
client := &http.Client{Timeout: weixinQRPollTimeout + 5*time.Second}
resp, err := client.Do(req)
if err != nil {
return nil, err
}
defer resp.Body.Close()
body, err := io.ReadAll(io.LimitReader(resp.Body, 1<<20))
if err != nil {View on GitHub (pinned to 4000b2338a)
Solutions
- Re-run the weixin setup command and scan the QR code promptly with the correct WeChat account
- Copy the QR code link/URL into a browser or WeChat-friendly viewer so it renders correctly before scanning
- Verify network access to the ilink API base so polling requests are not failing silently each iteration
- Increase the polling loop's iteration count/timeout in runWeixinQRLoginFlow if scans legitimately take longer in your environment
Defensive patterns
Strategy: retry
Try / catch
err := runWeixinSetup(ctx, ...)
if err != nil && strings.Contains(err.Error(), "等待扫码超时") {
// prompt user, then retry the whole QR flow to get a fresh code
return runWeixinSetup(ctx, ...)
} Prevention
- Have the QR code ready to scan before starting setup
- Render the QR in a terminal/browser that displays it legibly
- Scan with the WeChat account intended to own the bot
- Ensure stable connectivity to the ilink API before starting
When it happens
Trigger: Running `cc-connect setup` for the weixin platform via runWeixinSetup -> runWeixinQRLoginFlow and not scanning (or not confirming) the bot QR code within the polling loop's fixed number of one-second iterations before the loop falls through to this return.
Common situations: User walked away from the terminal; QR code was rendered in a terminal that mangled it; user scanned with the wrong WeChat account; slow network made each poll iteration effectively longer than expected so the wall-clock budget elapsed before the scan completed.
Understand the failure class
Background: Request timed out: what client-side request timeouts mean across libraries (Request timed out, TIMED_OUT, APITimeoutError) — this error's family across 39 libraries.
Related errors
- bind mode requires --token
- new/QR mode does not accept --token; use `cc-connect weixin
- get_qrcode_status http %d: %s
- no project found in config
- multiple projects found, please specify --project (%s)
AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06).
Data as JSON: /api/errors/86333bbaa6806be3.
Report an issue: GitHub.