{"record":{"id":"46e3885599537d5f","repo":"jackwener/OpenCLI","slug":"authrequirederror-gitee-com-waiting-for-gitee","errorCode":null,"errorMessage":"AuthRequiredError('gitee.com', 'Waiting for Gitee login')","messagePattern":"AuthRequiredError\\('gitee\\.com', 'Waiting for Gitee login'\\)","errorType":"exception","errorClass":"AuthRequiredError","httpStatus":null,"severity":"error","filePath":"clis/gitee/auth.js","lineNumber":38,"sourceCode":"  await page.goto('https://gitee.com/');\n  await page.wait(1);\n  const probe = await page.evaluate(WHOAMI_PROBE);\n  if (probe?.kind === 'auth') throw new AuthRequiredError('gitee.com', probe.detail);\n  if (probe?.kind === 'http') throw new CommandExecutionError(`HTTP ${probe.httpStatus} from Gitee /api/v5/user`);\n  if (probe?.kind === 'exception') throw new CommandExecutionError(`Gitee whoami failed: ${probe.detail}`);\n  if (!probe?.ok) throw new CommandExecutionError(`Unexpected Gitee probe: ${JSON.stringify(probe)}`);\n  return { user_id: probe.user_id, username: probe.username, name: probe.name };\n}\n\nregisterSiteAuthCommands({\n  site: 'gitee',\n  domain: 'gitee.com',\n  loginUrl: 'https://gitee.com/login',\n  columns: ['user_id', 'username', 'name'],\n  verify: verifyGiteeIdentity,\n  poll: async (page) => {\n    const probe = await page.evaluate(WHOAMI_PROBE);\n    if (!probe?.ok) throw new AuthRequiredError('gitee.com', 'Waiting for Gitee login');\n    return { user_id: probe.user_id, username: probe.username, name: probe.name };\n  },\n});\n","sourceCodeStart":20,"sourceCodeEnd":42,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/gitee/auth.js#L20-L42","documentation":"AuthRequiredError (code AUTH_REQUIRED, exit code NOPERM) signals that the Gitee browser session is not logged in. During gitee auth, the poll step runs a WHOAMI_PROBE in the browser page; if the probe does not return ok (no logged-in identity), the command throws with 'Waiting for Gitee login' and the domain 'gitee.com'. The library throws it to force the user to complete a manual browser login before identity columns (user_id, username, name) can be captured.","triggerScenarios":"Running the gitee auth/login command (or any command whose verification depends on it) while the attached Chrome/Chromium profile has no valid gitee.com session cookie; the WHOAMI_PROBE page.evaluate returns probe.ok falsy on the poll iteration.","commonSituations":"Fresh environment where Gitee login was never done; expired Gitee session or cleared cookies; logging into the wrong account or wrong browser profile; headless automation without an interactive login; Gitee session invalidated by password change or 2FA re-auth.","solutions":["Open Chrome/Chromium, visit https://gitee.com/login and complete the login, then rerun the command so the poll probe succeeds","Verify the CLI is attached to the same browser profile you logged in with (not an incognito/separate profile)","Clear stale cookies and re-login if the session was invalidated (password change, 2FA, session expiry)","Check gitee.com is reachable (no captive portal / firewall) so the probe page can load"],"exampleFix":"// before\nopencli gitee auth   # throws AuthRequiredError('gitee.com', 'Waiting for Gitee login')\n// after\n# 1) open Chrome and log in at https://gitee.com/login\n# 2) rerun\nopencli gitee auth   # probe ok -> captures user_id, username, name","handlingStrategy":"try-catch","validationCode":"// Check for an existing Gitee session before running auth-dependent commands\nconst hasSession = await page.evaluate(() => document.cookie.includes('_gitee_session')) || false;\nif (!hasSession) {\n  console.error('Not logged in to gitee.com — open https://gitee.com/login first');\n  process.exit(1);\n}","typeGuard":"function isAuthRequiredError(e) {\n  return e instanceof Error && e.name === 'AuthRequiredError' && e.code === 'AUTH_REQUIRED';\n}","tryCatchPattern":"try {\n  await giteeAuthVerify();\n} catch (e) {\n  if (isAuthRequiredError(e)) {\n    console.error(`${e.message}. Please open Chrome and log in to https://gitee.com/login, then rerun.`);\n    process.exit(e.exitCode ?? 1);\n  }\n  throw e;\n}","preventionTips":["Log in to gitee.com in the attached Chrome profile before running auth-gated commands","Reuse a persistent browser profile so session cookies survive restarts","Re-run auth periodically; Gitee sessions expire","Catch code AUTH_REQUIRED and print a login URL instead of a stack trace"],"tags":["authentication","gitee","login-required","browser-session"],"backgroundTag":"auth-required-login-pending","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}