{"record":{"id":"46b6fdaf43dbefce","repo":"chenhg5/cc-connect","slug":"timed-out-waiting-for-qr-onboarding-result","errorCode":null,"errorMessage":"timed out waiting for QR onboarding result","messagePattern":"timed out waiting for QR onboarding result","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/cc-connect/feishu.go","lineNumber":641,"sourceCode":"\n\t\tswitch pollRes.Error {\n\t\tcase \"\", \"authorization_pending\":\n\t\tcase \"slow_down\":\n\t\t\tinterval += 5\n\t\tcase \"access_denied\":\n\t\t\treturn nil, fmt.Errorf(\"authorization denied by user\")\n\t\tcase \"expired_token\":\n\t\t\treturn nil, fmt.Errorf(\"onboarding session expired\")\n\t\tdefault:\n\t\t\tif pollRes.Error != \"\" {\n\t\t\t\treturn nil, fmt.Errorf(\"%s: %s\", pollRes.Error, pollRes.ErrorDescription)\n\t\t\t}\n\t\t}\n\n\t\ttime.Sleep(time.Duration(interval) * time.Second)\n\t}\n\n\treturn nil, fmt.Errorf(\"timed out waiting for QR onboarding result\")\n}\n\nfunc (c *registrationClient) registrationCall(action string, params map[string]string, out any) error {\n\tform := url.Values{}\n\tform.Set(\"action\", action)\n\tfor k, v := range params {\n\t\tform.Set(k, v)\n\t}\n\n\treq, err := http.NewRequest(http.MethodPost, c.baseURL+\"/oauth/v1/app/registration\", strings.NewReader(form.Encode()))\n\tif err != nil {\n\t\treturn err\n\t}\n\treq.Header.Set(\"Content-Type\", \"application/x-www-form-urlencoded\")\n\n\tresp, err := c.http.Do(req)\n\tif err != nil {\n\t\treturn err","sourceCodeStart":623,"sourceCodeEnd":659,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/cmd/cc-connect/feishu.go#L623-L659","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Re-run the setup command and complete the QR scan/approval within the window.","Watch for 'slow_down' behavior — complete the scan promptly instead of letting backoff eat the budget.","Avoid suspending/sleeping the machine during setup; if it slept, just restart the flow.","If the window is consistently too short for your workflow, check for a client update that lengthens the timeout."],"exampleFix":"// before\n// QR never scanned → timed out waiting for QR onboarding result\n// after\n$ cc-connect setup feishu   # run, then scan immediately","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := runRegistrationFlow(...); err != nil {\n\tif strings.Contains(err.Error(), \"timed out waiting for QR onboarding\") {\n\t\tfmt.Println(\"No approval within the window. Re-run setup and scan promptly.\")\n\t\treturn err\n\t}\n\treturn err\n}","preventionTips":["Be ready to scan the QR before starting the setup command.","Avoid machine sleep during the window; slow_down backoff shortens effective time.","Restart the flow — each run issues a fresh device code with a full window."],"tags":["feishu","oauth","timeout","polling"],"backgroundTag":"request-timeout","analyzedSha":"4000b2338aa6e850c99df54f8b0ed6ed7460b401","analyzedAt":"2026-09-06T11:45:09.575Z","contentChangedAt":"2026-09-06T11:45:09.575Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}