chenhg5/cc-connect · error

timed out waiting for QR onboarding result

Error message

timed out waiting for QR onboarding result

What it means

The polling loop exhausted its local time budget (timeoutAt) without the poll response ever indicating success, denial, or expiry — the session just stayed in authorization_pending until the loop fell through. The flow gives up with this message rather than polling forever.

Source

Thrown at cmd/cc-connect/feishu.go:641

		switch pollRes.Error {
		case "", "authorization_pending":
		case "slow_down":
			interval += 5
		case "access_denied":
			return nil, fmt.Errorf("authorization denied by user")
		case "expired_token":
			return nil, fmt.Errorf("onboarding session expired")
		default:
			if pollRes.Error != "" {
				return nil, fmt.Errorf("%s: %s", pollRes.Error, pollRes.ErrorDescription)
			}
		}

		time.Sleep(time.Duration(interval) * time.Second)
	}

	return nil, fmt.Errorf("timed out waiting for QR onboarding result")
}

func (c *registrationClient) registrationCall(action string, params map[string]string, out any) error {
	form := url.Values{}
	form.Set("action", action)
	for k, v := range params {
		form.Set(k, v)
	}

	req, err := http.NewRequest(http.MethodPost, c.baseURL+"/oauth/v1/app/registration", strings.NewReader(form.Encode()))
	if err != nil {
		return err
	}
	req.Header.Set("Content-Type", "application/x-www-form-urlencoded")

	resp, err := c.http.Do(req)
	if err != nil {
		return err

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Re-run the setup command and complete the QR scan/approval within the window.
  2. Watch for 'slow_down' behavior — complete the scan promptly instead of letting backoff eat the budget.
  3. Avoid suspending/sleeping the machine during setup; if it slept, just restart the flow.
  4. If the window is consistently too short for your workflow, check for a client update that lengthens the timeout.

Example fix

// before
// QR never scanned → timed out waiting for QR onboarding result
// after
$ cc-connect setup feishu   # run, then scan immediately
Defensive patterns

Strategy: retry

Try / catch

if err := runRegistrationFlow(...); err != nil {
	if strings.Contains(err.Error(), "timed out waiting for QR onboarding") {
		fmt.Println("No approval within the window. Re-run setup and scan promptly.")
		return err
	}
	return err
}

Prevention

When it happens

Trigger: time.Now().Before(timeoutAt) becomes false while every poll iteration returned "" or "authorization_pending" (or slow_down adjustments consumed the budget) — i.e. the user never scanned/approved the QR before the local deadline.

Common situations: User never scanning the QR; user scanning after the window but before the server reports expired_token; slow_down backoff (+5s per hit) quietly consuming the entire window; machine suspended so wall-clock time jumps past timeoutAt.

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/46b6fdaf43dbefce. Report an issue: GitHub.