jackwener/OpenCLI · warning · AuthRequiredError
Waiting for Nowcoder login
Error message
Waiting for Nowcoder login
What it means
During the login flow, the poll callback checks for the `t` session cookie; while it is absent it throws AuthRequiredError('Waiting for Nowcoder login') to signal the watcher to keep waiting rather than verifying. This is the normal 'not yet logged in' signal during interactive login, not a hard failure of verification.
Source
Thrown at clis/nowcoder/auth.js:61
await page.goto('https://www.nowcoder.com/');
await page.wait(2);
const probe = await page.evaluate(WHOAMI_PROBE);
if (probe?.kind === 'auth') throw new AuthRequiredError('nowcoder.com', probe.detail);
if (probe?.kind === 'http') throw new CommandExecutionError(`HTTP ${probe.httpStatus} from nowcoder profile API`);
if (probe?.kind === 'exception') throw new CommandExecutionError(`Nowcoder whoami failed: ${probe.detail}`);
if (!probe?.ok) throw new CommandExecutionError(`Unexpected nowcoder probe: ${JSON.stringify(probe)}`);
return { user_id: probe.user_id, nickname: probe.nickname };
}
registerSiteAuthCommands({
site: 'nowcoder',
domain: 'nowcoder.com',
loginUrl: 'https://www.nowcoder.com/login',
columns: ['user_id', 'nickname'],
verify: verifyNowcoderIdentity,
poll: async (page) => {
if (!await hasNowcoderSessionCookie(page)) {
throw new AuthRequiredError('nowcoder.com', 'Waiting for Nowcoder login');
}
return verifyNowcoderIdentity(page);
},
});
View on GitHub (pinned to 49907e53dc)
Solutions
- Complete the login in the opened browser window/tab
- Confirm login landed in the same browser profile the CLI polls (check cookie store)
- If finished but still failing, manually verify the `t` cookie exists for https://www.nowcoder.com and restart the command
- Disable cookie-blocking extensions/private mode for the login session
Example fix
// before
await startNowcoderLogin();
await verifyNowcoderIdentity(page);
// after
await startNowcoderLogin();
for (let i = 0; i < 60; i++) {
const cookies = await page.getCookies({ url: 'https://www.nowcoder.com' });
if (cookies.some(c => c.name === 't' && c.value)) return verifyNowcoderIdentity(page);
await new Promise(r => setTimeout(r, 2000));
}
throw new AuthRequiredError('nowcoder.com', 'Waiting for Nowcoder login'); Defensive patterns
Strategy: retry
Validate before calling
const cookies = await page.getCookies({ url: 'https://www.nowcoder.com' });
const ready = cookies.some(c => c.name === 't' && c.value);
if (!ready) {
// prompt the user to finish login at https://www.nowcoder.com/login
await waitForUserLogin();
} Type guard
function loginCompleted(cookies) {
return cookies.some(c => c.name === 't' && c.value.length > 0);
} Try / catch
try {
await waitForNowcoderLogin(page);
} catch (e) {
if (e instanceof AuthRequiredError && /Waiting for Nowcoder login/.test(e.message)) {
console.log('Complete the login in the browser, then re-run.');
return waitForNowcoderLogin(page);
}
throw e;
} Prevention
- Complete the login promptly in the opened browser window
- Use the same browser profile for login and verification
- Avoid private/incognito mode or cookie-blocking extensions during login
- Verify the `t` cookie appears after login before re-running commands
When it happens
Trigger: User hasn't completed the login at https://www.nowcoder.com/login yet while the CLI is polling; login succeeded but cookies are set on a different domain/subdomain than checked; cookies blocked or cleared during the login session.
Common situations: User abandoned or is slow completing login; logging into a different browser profile than the one polled; privacy settings/cookie blocking preventing `t` from being stored.
Related errors
- Waiting for V2EX A2 session cookie
- Waiting for Bilibili session cookies
- Waiting for Boss wt2 / t cookies
- Waiting for Douban dbcl2 / ck cookies
- Waiting for GitHub session cookies
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/1889a0dfa91b552d.
Report an issue: GitHub.