jackwener/OpenCLI · error · CommandExecutionError
Taobao my_itaobao rendered but no user_id extractable —…
Error message
Taobao my_itaobao rendered but no user_id extractable — stale cookie2 or layout drift
What it means
After tracknick confirms a session, verifyTaobaoIdentity scrapes user_id from the rendered my_itaobao page DOM. If the page rendered but no user_id could be extracted, the library throws CommandExecutionError, indicating the stored auth cookie (cookie2) is stale or the page layout changed so the userId regex no longer matches.
Solutions
- Re-login to refresh cookie2 and other session cookies, then verify again
- Inspect the rendered my_itaobao HTML and update the userId extraction regex/selectors in clis/taobao/auth.js to match current markup
- Dump page.content() on failure to diagnose whether the page is a captcha/interstitial rather than the real profile page
- Pin/retry against the m. or alternate Taobao profile URL if the desktop template drifted
Example fix
// before
const userIdMatch = html.match(/userId["'\s:=]+(\d+)/i);
// after (broaden extraction)
const userIdMatch = html.match(/userId["'\s:=]+(\d+)/i)
|| html.match(/"userId":"?(\d+)/i)
|| (await page.evaluate(() => document.querySelector('[data-userid]')?.dataset.userid)); Defensive patterns
Strategy: try-catch
Validate before calling
const html = await page.evaluate(() => document.body?.innerHTML || '');
if (!/userId["'\s:=]+(\d+)/i.test(html)) console.warn('userId marker missing — layout may have drifted'); Type guard
function hasExtractableUserId(domInfo) {
return domInfo != null && Boolean(domInfo.user_id) && /^\d+$/.test(String(domInfo.user_id));
} Try / catch
try {
const identity = await verifyTaobaoIdentity(page);
} catch (e) {
if (/no user_id extractable/.test(e.message)) {
await page.reload({ waitUntil: 'networkidle' }); // or re-login to refresh cookie2
return verifyTaobaoIdentity(page);
}
throw e;
} Prevention
- Re-login periodically; stale cookie2 causes half-authenticated pages
- Snapshot page.content() on extraction failure for debugging layout drift
- Keep extraction selectors/regexes in one place and update on Taobao redesigns
- Wait for the profile section to render (networkidle/specific selector) before evaluate
When it happens
Trigger: domInfo.user_id is falsy after page.evaluate on the my_itaobao page: the userId regex /userId["'\s:=]+(\d+)/i finds no match in body HTML and no .user-nick/.site-nav-user/.user-name selector yields an id. Happens with a half-valid session (cookie2 stale) or Taobao markup changes.
Common situations: Taobao front-end redeploy changed element classes; session valid enough to render page but server treats it as degraded; A/B-tested layout variants; region-specific pages rendering a different template.
Related errors
- Booking.com hotel row is missing stable name/url identity
- taobao cart requires a logged-in Taobao session
- taobao search requires a logged-in Taobao session
- Tieba may have blocked the hot page, or the DOM structure…
- 1point3acres request failed
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/dd0c09b8fb7748d9.
Report an issue: GitHub.
Appendix: source
Thrown at clis/taobao/auth.js:40
throw new AuthRequiredError('taobao.com', 'Taobao tracknick cookie absent after navigation');
}
const domInfo = await page.evaluate(`
(() => {
const nick = (document.querySelector('.user-nick, .site-nav-user, .user-name')?.innerText || '').trim();
const html = document.body?.innerHTML || '';
const userIdMatch = html.match(/userId[\"'\\s:=]+(\\d+)/i);
return { nickname: nick, user_id: userIdMatch?.[1] || '' };
})()
`);
let decodedTracknick = '';
try {
decodedTracknick = JSON.parse('"' + tracknick.replace(/\\/g, '\\\\') + '"');
} catch {
decodedTracknick = tracknick;
}
const nickname = domInfo.nickname || decodedTracknick;
if (!domInfo.user_id) {
throw new CommandExecutionError('Taobao my_itaobao rendered but no user_id extractable — stale cookie2 or layout drift');
}
return { user_id: String(domInfo.user_id), nickname: String(nickname) };
}
registerSiteAuthCommands({
site: 'taobao',
domain: 'taobao.com',
loginUrl: 'https://login.taobao.com/member/login.jhtml',
columns: ['user_id', 'nickname'],
quickCheck: hasTaobaoSessionCookie,
verify: verifyTaobaoIdentity,
poll: async (page) => {
if (!await hasTaobaoSessionCookie(page)) {
throw new AuthRequiredError('taobao.com', 'Waiting for Taobao tracknick cookie');
}
return verifyTaobaoIdentity(page);
},
});View on GitHub (pinned to 49907e53dc)