{"record":{"id":"062ac702d4194ee8","repo":"chenhg5/cc-connect","slug":"onboarding-session-expired","errorCode":null,"errorMessage":"onboarding session expired","messagePattern":"onboarding session expired","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/cc-connect/feishu.go","lineNumber":631,"sourceCode":"\t\t}\n\n\t\tif pollRes.ClientID != \"\" && pollRes.ClientSecret != \"\" {\n\t\t\treturn &registrationFlowResult{\n\t\t\t\tAppID:       pollRes.ClientID,\n\t\t\t\tAppSecret:   pollRes.ClientSecret,\n\t\t\t\tOwnerOpenID: pollRes.UserInfo.OpenID,\n\t\t\t\tPlatform:    platformType,\n\t\t\t}, nil\n\t\t}\n\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}","sourceCodeStart":613,"sourceCodeEnd":649,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/cmd/cc-connect/feishu.go#L613-L649","documentation":"The device-code onboarding session expired before the user completed authorization: the poll response carried error=expired_token. Device codes have a server-defined lifetime; if the QR is not scanned and approved in time, the session can no longer be completed and the flow aborts.","triggerScenarios":"The polling loop receives pollRes.Error == \"expired_token\" — the user waited too long to scan/approve, or the interval/slow-down handling stretched the loop past the server's device-code expiry.","commonSituations":"QR code left on screen for many minutes while the user fetched their phone; repeated slow_down responses pushing the effective wait past expiry; user abandoning the flow and returning later to the same stale QR.","solutions":["Re-run the setup command to get a fresh QR code and scan it promptly.","Scan the QR soon after it appears — treat the code as short-lived.","If you keep hitting slow_down/expiry, do not slow the loop further; restart the flow rather than continue polling an aging session.","Check clock skew on the machine — a wildly wrong local clock can distort the local timeout loop."],"exampleFix":"// before\n// QR left >10 min → onboarding session expired\n// after\n$ cc-connect setup feishu   # scan the new QR within a minute or two","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := runRegistrationFlow(...); err != nil {\n\tif strings.Contains(err.Error(), \"onboarding session expired\") {\n\t\tfmt.Println(\"QR expired. Re-running setup for a fresh code...\")\n\t\treturn runRegistrationFlow(...) // one fresh attempt\n\t}\n\treturn err\n}","preventionTips":["Scan the QR promptly after it appears.","Restart the flow on expiry instead of continuing to poll a dead session.","Keep the machine awake during setup; avoid clock skew."],"tags":["feishu","oauth","device-code","expired"],"backgroundTag":"oauth-token-expired","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"}