{"record":{"id":"86333bbaa6806be3","repo":"chenhg5/cc-connect","slug":"error","errorCode":null,"errorMessage":"等待扫码超时，请重试","messagePattern":"等待扫码超时，请重试","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"cmd/cc-connect/weixin.go","lineNumber":382,"sourceCode":"\t\t\tif strings.TrimSpace(status.IlinkBotID) == \"\" {\n\t\t\t\treturn nil, fmt.Errorf(\"login confirmed but ilink_bot_id missing\")\n\t\t\t}\n\t\t\tif strings.TrimSpace(status.BotToken) == \"\" {\n\t\t\t\treturn nil, fmt.Errorf(\"login confirmed but bot_token missing\")\n\t\t\t}\n\t\t\tfmt.Println(\"\\n✅ 已与微信建立连接。\")\n\t\t\treturn &weixinQRLoginResult{\n\t\t\t\tBotToken:    strings.TrimSpace(status.BotToken),\n\t\t\t\tIlinkBotID:  strings.TrimSpace(status.IlinkBotID),\n\t\t\t\tBaseURL:     strings.TrimSpace(status.BaseURL),\n\t\t\t\tIlinkUserID: strings.TrimSpace(status.IlinkUserID),\n\t\t\t}, nil\n\t\tdefault:\n\t\t\ttime.Sleep(time.Second)\n\t\t}\n\t}\n\n\treturn nil, fmt.Errorf(\"等待扫码超时，请重试\")\n}\n\nfunc weixinHTTPGet(ctx context.Context, fullURL, routeTag string, debug bool) ([]byte, error) {\n\treq, err := http.NewRequestWithContext(ctx, http.MethodGet, fullURL, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif routeTag != \"\" {\n\t\treq.Header.Set(\"SKRouteTag\", routeTag)\n\t}\n\tclient := &http.Client{Timeout: weixinQRPollTimeout + 5*time.Second}\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\tbody, err := io.ReadAll(io.LimitReader(resp.Body, 1<<20))\n\tif err != nil {","sourceCodeStart":364,"sourceCodeEnd":400,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/cmd/cc-connect/weixin.go#L364-L400","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"err := runWeixinSetup(ctx, ...)\nif err != nil && strings.Contains(err.Error(), \"等待扫码超时\") {\n    // prompt user, then retry the whole QR flow to get a fresh code\n    return runWeixinSetup(ctx, ...)\n}","preventionTips":["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"],"tags":["timeout","qr-login","weixin","setup","cli"],"backgroundTag":"request-timeout","analyzedSha":"4000b2338aa6e850c99df54f8b0ed6ed7460b401","analyzedAt":"2026-09-06T11:45:09.575Z","contentChangedAt":"2026-09-06T11:45:09.575Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}