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

  1. Re-run the weixin setup command and scan the QR code promptly with the correct WeChat account
  2. Copy the QR code link/URL into a browser or WeChat-friendly viewer so it renders correctly before scanning
  3. Verify network access to the ilink API base so polling requests are not failing silently each iteration
  4. 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

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


AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06). Data as JSON: /api/errors/86333bbaa6806be3. Report an issue: GitHub.