jackwener/OpenCLI · warning · AuthRequiredError

Waiting for Bilibili session cookies

Error message

Waiting for Bilibili session cookies

What it means

During interactive Bilibili login the CLI polls the browser page until session cookies (SESSDATA etc.) appear. If a poll tick finds the cookies still absent it throws AuthRequiredError with this message, signalling login has not completed yet rather than a hard failure.

Source

Thrown at clis/bilibili/auth.js:32

  const payload = await apiGet(page, '/x/space/wbi/acc/info', { params: { mid: uid }, signed: true });
  const data = payload?.data ?? {};
  return {
    id: String(data.mid ?? uid),
    username: data.name ?? '',
    level: data.level ?? 0,
  };
}

registerSiteAuthCommands({
  site: 'bilibili',
  domain: 'www.bilibili.com',
  loginUrl: 'https://passport.bilibili.com/login',
  columns: ['id', 'username', 'level'],
  quickCheck: hasBilibiliSessionCookies,
  verify: verifyBilibiliIdentity,
  poll: async (page) => {
    if (!await hasBilibiliSessionCookies(page)) {
      throw new AuthRequiredError('bilibili.com', 'Waiting for Bilibili session cookies');
    }
    return verifyBilibiliIdentity(page);
  },
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Complete the login in the opened browser page (scan QR or enter credentials) and let polling continue
  2. Re-run the login command and keep the browser open until the CLI reports success
  3. Confirm the automated browser profile is the one being logged into (no competing sessions)
  4. Check bilibili.com is reachable and not blocked by proxy/VPN

Example fix

// before
await cli.login(); // throws while cookies absent
// after
try { await cli.login(); } catch (e) { console.log('Finish login in the browser, then retry'); }
Defensive patterns

Strategy: retry

Try / catch

try { await login(); } catch (e) { if (String(e.message).includes('Waiting for Bilibili session cookies')) { await sleep(pollInterval); return login(); } throw e; }

Prevention

When it happens

Trigger: The poll callback runs hasBilibiliSessionCookies(page) after the user is shown the passport.bilibili.com login page and the cookies are not yet set — e.g. user has not finished logging in, or the login was aborted/cancelled before cookies were stored.

Common situations: User closes the browser window mid-login; QR-code/credentials flow not completed within the poll window; login page open in a different browser profile than the automated session; region-blocked login preventing session establishment.

Related errors


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