jackwener/OpenCLI · warning · AuthRequiredError

Waiting for Xiaohongshu session cookies

Error message

Waiting for Xiaohongshu session cookies

What it means

The auth poll for creator.xiaohongshu.com throws this AuthRequiredError while waiting for the user to complete login: hasXhsSessionCookies(page) is still false, so the session isn't established yet. It is the library's way of saying 'keep waiting — the login flow isn't finished'.

Source

Thrown at clis/xiaohongshu/auth.js:49

  if (!data) {
    throw new CommandExecutionError('Xiaohongshu creator profile returned malformed personal_info payload');
  }
  return {
    username: data.name ?? '',
    followers: data.fans_count ?? 0,
  };
}

registerSiteAuthCommands({
  site: 'xiaohongshu',
  domain: 'creator.xiaohongshu.com',
  loginUrl: 'https://creator.xiaohongshu.com/',
  columns: ['username', 'followers'],
  quickCheck: hasXhsSessionCookies,
  verify: verifyXhsIdentity,
  poll: async (page) => {
    if (!await hasXhsSessionCookies(page)) {
      throw new AuthRequiredError('creator.xiaohongshu.com', 'Waiting for Xiaohongshu session cookies');
    }
    return verifyXhsIdentity(page);
  },
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Complete the login in the opened browser window (scan QR / enter credentials).
  2. Wait and let the poll retry — the error clears once cookies appear.
  3. Enable cookies for xiaohongshu.com in the browser profile.
  4. Reload the login page if it is stuck on verification.
  5. Verify the login URL is https://creator.xiaohongshu.com/ and reachable.

Example fix

// before
await loginFlow.start(); // polls; throws 'Waiting for Xiaohongshu session cookies'
// after
await loginFlow.start();
// keep polling / prompt user until quickCheck passes:
while (!await hasXhsSessionCookies(page)) {
  promptUser('Finish login in the browser window...');
  await sleep(2000);
}
Defensive patterns

Strategy: retry

Validate before calling

// check cookies yourself before/while waiting
const ready = await hasXhsSessionCookies(page);
if (!ready) console.log('Waiting for user to finish login...');

Try / catch

try {
  const identity = await authPoll(page);
} catch (e) {
  if (/Waiting for Xiaohongshu session cookies/.test(e.message)) {
    await sleep(3000);            // poll is still waiting — keep going
    return authPoll(page);
  }
  throw e;
}

Prevention

When it happens

Trigger: During the interactive login flow, the poll callback runs and the page still lacks the XHS session cookies (user hasn't finished QR-code/password login or cookies were blocked).

Common situations: User hasn't scanned the QR code yet; login page is stuck on CAPTCHA/verification; browser profile blocks or drops cookies (privacy settings, incognito); wrong login URL opened.

Related errors


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