jackwener/OpenCLI · warning · AuthRequiredError

Waiting for Boss wt2 / t cookies

Error message

Waiting for Boss wt2 / t cookies

What it means

The boss auth poll callback throws AuthRequiredError with 'Waiting for Boss wt2 / t cookies' when, during the polling window after the user is sent to the login page, the browser still has no 'wt2' or 't' cookie. This is the poll-loop signal that login has not completed yet. The poller typically keeps retrying until the cookie appears or the timeout expires.

Solutions

  1. Complete the login in the opened browser window (scan QR code / enter SMS code) before the poll timeout expires
  2. Re-run the login command if the window closed or timed out; you get a fresh polling window
  3. Confirm the browser window used for login is the CLI-managed automation profile, not your personal browser
  4. If cookies are set but not seen, check cookie domain scope for wt2/t in DevTools and ensure no cookie-blocking extensions are active

Example fix

// before: closed login window, poll times out
// after: keep the automation window open and finish verification
await opencli login boss; // then scan the QR code in the opened window
// poll succeeds once wt2/t cookie lands
Defensive patterns

Strategy: retry

Validate before calling

// Before waiting on the poll, confirm the login page is actually open
const url = page.url();
if (!url.includes('login.zhipin.com') && !url.includes('zhipin.com')) {
  console.warn('not on zhipin login; user cannot complete login');
}

Type guard

function cookiesArrived(cookies) {
  return Array.isArray(cookies) &&
    cookies.some(c => c.name === 'wt2' || c.name === 't');
}

Try / catch

try {
  await waitForBossLogin(page, { timeoutMs: 120000 });
} catch (err) {
  if (err instanceof AuthRequiredError && err.message.includes('Waiting for Boss')) {
    // login not completed within window — prompt and retry once
    await promptUser('Finish the QR/SMS login in the automation browser, then press Enter');
    return waitForBossLogin(page, { timeoutMs: 120000 });
  }
  throw err;
}

Prevention

When it happens

Trigger: During the interactive login flow (registerSiteAuthCommands poll): the user has not finished login (no SMS/QR verification), login is on a different browser profile/window, or the login page failed to set cookies because of a network/verification failure while polling continues.

Common situations: User slow to complete QR-code or SMS verification before poll timeout; automation browser window closed accidentally; login blocked by captcha; cookies set on a different domain variant (e.g. .zhipin.com subdomain mismatch) so getCookies({url:'https://www.zhipin.com'}) doesn't see them.

Related errors


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

Appendix: source

Thrown at clis/boss/auth.js:46

      }
      return { ok: true, user_type: userType };
    })()
  `);
  if (probe?.kind === 'auth') throw new AuthRequiredError('zhipin.com', probe.detail);
  if (!probe?.ok) throw new CommandExecutionError(`Unexpected Boss probe: ${JSON.stringify(probe)}`);
  return { user_type: probe.user_type };
}

registerSiteAuthCommands({
  site: 'boss',
  domain: 'zhipin.com',
  loginUrl: 'https://login.zhipin.com/',
  columns: ['user_type'],
  quickCheck: hasBossSessionCookie,
  verify: verifyBossIdentity,
  poll: async (page) => {
    if (!await hasBossSessionCookie(page)) {
      throw new AuthRequiredError('zhipin.com', 'Waiting for Boss wt2 / t cookies');
    }
    return verifyBossIdentity(page);
  },
});

export const __test__ = {
  BOSS_GEEK_JOBS_URL,
  verifyBossIdentity,
};

View on GitHub (pinned to 49907e53dc)