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

  1. Complete the login in the opened browser window/tab
  2. Confirm login landed in the same browser profile the CLI polls (check cookie store)
  3. If finished but still failing, manually verify the `t` cookie exists for https://www.nowcoder.com and restart the command
  4. 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

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


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/1889a0dfa91b552d. Report an issue: GitHub.