jackwener/OpenCLI · error · AuthRequiredError
AuthRequiredError('gitee.com', 'Waiting for Gitee login')
Error message
AuthRequiredError('gitee.com', 'Waiting for Gitee login') What it means
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.
Source
Thrown at clis/gitee/auth.js:38
await page.goto('https://gitee.com/');
await page.wait(1);
const probe = await page.evaluate(WHOAMI_PROBE);
if (probe?.kind === 'auth') throw new AuthRequiredError('gitee.com', probe.detail);
if (probe?.kind === 'http') throw new CommandExecutionError(`HTTP ${probe.httpStatus} from Gitee /api/v5/user`);
if (probe?.kind === 'exception') throw new CommandExecutionError(`Gitee whoami failed: ${probe.detail}`);
if (!probe?.ok) throw new CommandExecutionError(`Unexpected Gitee probe: ${JSON.stringify(probe)}`);
return { user_id: probe.user_id, username: probe.username, name: probe.name };
}
registerSiteAuthCommands({
site: 'gitee',
domain: 'gitee.com',
loginUrl: 'https://gitee.com/login',
columns: ['user_id', 'username', 'name'],
verify: verifyGiteeIdentity,
poll: async (page) => {
const probe = await page.evaluate(WHOAMI_PROBE);
if (!probe?.ok) throw new AuthRequiredError('gitee.com', 'Waiting for Gitee login');
return { user_id: probe.user_id, username: probe.username, name: probe.name };
},
});
View on GitHub (pinned to 49907e53dc)
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
Example fix
// before
opencli gitee auth # throws AuthRequiredError('gitee.com', 'Waiting for Gitee login')
// after
# 1) open Chrome and log in at https://gitee.com/login
# 2) rerun
opencli gitee auth # probe ok -> captures user_id, username, name Defensive patterns
Strategy: try-catch
Validate before calling
// Check for an existing Gitee session before running auth-dependent commands
const hasSession = await page.evaluate(() => document.cookie.includes('_gitee_session')) || false;
if (!hasSession) {
console.error('Not logged in to gitee.com — open https://gitee.com/login first');
process.exit(1);
} Type guard
function isAuthRequiredError(e) {
return e instanceof Error && e.name === 'AuthRequiredError' && e.code === 'AUTH_REQUIRED';
} Try / catch
try {
await giteeAuthVerify();
} catch (e) {
if (isAuthRequiredError(e)) {
console.error(`${e.message}. Please open Chrome and log in to https://gitee.com/login, then rerun.`);
process.exit(e.exitCode ?? 1);
}
throw e;
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- ${probe.detail}
- Browser session required for bilibili subtitle
- Bilibili subtitles are hidden behind login for this video. P
- Browser session required for bilibili summary
- Browser session required for bilibili unfollow
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/46e3885599537d5f.
Report an issue: GitHub.