jackwener/OpenCLI · warning · AuthRequiredError
Waiting for Xiaoe XIAOEID/b_user_token cookie
Error message
Waiting for Xiaoe XIAOEID/b_user_token cookie
What it means
The poll handler, run repeatedly while waiting for the user to finish logging in, calls hasXiaoeAdminCookie and throws AuthRequiredError('Waiting for Xiaoe XIAOEID/b_user_token cookie') until the cookie appears. It is the expected signal during interactive login polling, not a fatal fault.
Source
Thrown at clis/xiaoe/auth.js:51
throw new AuthRequiredError('xiaoe-tech.com', 'Xiaoe admin page showed login UI — anonymous session');
}
const userId = xiaoeId || unionId;
if (!userId) {
throw new CommandExecutionError('Xiaoe admin page rendered but no user_id cookie extractable — stale session');
}
return { user_id: String(userId), nickname: String(probe.domNick || '') };
}
registerSiteAuthCommands({
site: 'xiaoe',
domain: 'xiaoe-tech.com',
loginUrl: 'https://admin.xiaoe-tech.com/',
columns: ['user_id', 'nickname'],
quickCheck: hasXiaoeAdminCookie,
verify: verifyXiaoeIdentity,
poll: async (page) => {
if (!await hasXiaoeAdminCookie(page)) {
throw new AuthRequiredError('xiaoe-tech.com', 'Waiting for Xiaoe XIAOEID/b_user_token cookie');
}
return verifyXiaoeIdentity(page);
},
});
View on GitHub (pinned to 49907e53dc)
Solutions
- Complete the login in the opened browser window (including WeChat scan if required) and keep polling.
- Ensure you log in on https://admin.xiaoe-tech.com/, not the h5 storefront.
- Extend the poll timeout if login (QR scan) takes longer than the allotted window.
- Verify the polling browser context is the same profile where the user is logging in.
Example fix
// before
await waitForAuth(page, { timeoutMs: 30000 }); // too short for QR login
// after
await waitForAuth(page, { timeoutMs: 120000, poll }); // allow time for WeChat QR scan Defensive patterns
Strategy: retry
Validate before calling
while (Date.now() < deadline) {
const cookies = await page.getCookies({ url: 'https://admin.xiaoe-tech.com' });
if (cookies.some(c => (c.name === 'XIAOEID' || c.name === 'b_user_token') && c.value)) break;
await sleep(1000);
} Type guard
const hasCookie = cs => Array.isArray(cs) && cs.some(c => (c.name === 'XIAOEID' || c.name === 'b_user_token') && !!c.value);
Try / catch
try {
await poll(page);
} catch (e) {
if (e instanceof AuthRequiredError && /Waiting for Xiaoe/.test(e.message)) {
await sleep(1000); // expected during login — keep polling
} else throw e;
} Prevention
- Treat this error as an expected polling signal, not a failure.
- Set a poll timeout generous enough for WeChat QR-scan login (2+ minutes).
- Prompt the user clearly to complete login on admin.xiaoe-tech.com.
When it happens
Trigger: Auth polling loop invokes poll(page) after the user opened the login URL, but page.getCookies({url:'https://admin.xiaoe-tech.com'}) still shows no non-empty XIAOEID or b_user_token.
Common situations: User has not completed the Xiaoe login/WeChat scan yet; user logged into the wrong account or a different domain (h5.xet.citv.cn instead of admin.xiaoe-tech.com); polling window too short before timeout.
Related errors
- Waiting for Bilibili session cookies
- Waiting for Douban dbcl2 / ck cookies
- Waiting for GitHub session cookies
- Waiting for Manus session cookies
- Waiting for Nowcoder login
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/5e986789ef531dd8.
Report an issue: GitHub.