jackwener/OpenCLI · error · CommandExecutionError
Dianping member page rendered but no user_id link found — st
Error message
Dianping member page rendered but no user_id link found — stale dper or layout drift
What it means
CommandExecutionError raised when the Dianping member page renders but the DOM scrape finds no /member/<digits> profile link, so no user_id can be extracted. The library assumes either the dper session is stale (page rendered a logged-out shell) or Dianping's page layout changed. It is a scraping-contract failure, not an auth error per se.
Source
Thrown at clis/dianping/auth.js:31
await page.goto('https://www.dianping.com/member/myinformation');
await page.wait(2);
const finalUrl = await page.evaluate(`location.href`);
if (/account\.dianping\.com\/(pc)?login/.test(String(finalUrl || ''))) {
throw new AuthRequiredError('dianping.com', `Dianping member page redirected to login: ${finalUrl}`);
}
const info = await page.evaluate(`
(() => {
const nicknameEl = document.querySelector('.user-name, .username, .nickname, .user-info .name');
const nickname = (nicknameEl?.textContent || '').trim();
const profileLink = Array.from(document.querySelectorAll('a[href*="/member/"]'))
.map(a => a.getAttribute('href') || '')
.find(h => /\\/member\\/\\d+/.test(h));
const uidMatch = String(profileLink || '').match(/\\/member\\/(\\d+)/);
return { user_id: uidMatch?.[1] || '', nickname };
})()
`);
if (!info?.user_id) {
throw new CommandExecutionError('Dianping member page rendered but no user_id link found — stale dper or layout drift');
}
return { user_id: String(info.user_id), nickname: String(info.nickname || '') };
}
registerSiteAuthCommands({
site: 'dianping',
domain: 'dianping.com',
loginUrl: 'https://account.dianping.com/pclogin',
columns: ['user_id', 'nickname'],
quickCheck: hasDianpingSessionCookie,
verify: verifyDianpingIdentity,
poll: async (page) => {
if (!await hasDianpingSessionCookie(page)) {
throw new AuthRequiredError('dianping.com', 'Waiting for Dianping dper cookie');
}
return verifyDianpingIdentity(page);
},
});View on GitHub (pinned to 49907e53dc)
Solutions
- Re-login to refresh the dper session, then retry — a stale session often renders a logged-out page without the profile link.
- Increase the wait before evaluate (wait for the .user-name/.member link selector instead of a fixed 2s) and retry.
- Inspect the live page HTML and update the selectors in auth.js (nickname/user_id extraction) if Dianping changed its layout.
- Save the page HTML/screenshot on failure to distinguish layout drift from a bot/verification page.
Example fix
// before
await page.wait(2);
const info = await page.evaluate(...);
// after
await page.waitForSelector('a[href*="/member/"]', { timeout: 10000 }).catch(() => null);
const info = await page.evaluate(...); Defensive patterns
Strategy: retry
Validate before calling
await page.waitForSelector('a[href*="/member/"]', { timeout: 10000 }).catch(() => null);
// only then call verify Type guard
function extractUserId(html) { const m = String(html||'').match(/\/member\/(\d+)/); return m ? m[1] : null; } Try / catch
try { identity = await cli.dianping.verify(); }
catch (e) { if (e.name === 'CommandExecutionError' && /user_id link found/.test(e.message)) { await page.reload({ waitUntil: 'networkidle' }); identity = await cli.dianping.verify(); } else throw e; } Prevention
- Wait for the profile anchor selector instead of a fixed sleep before scraping.
- Screenshot/save HTML on failure to distinguish layout drift from bot walls.
- Keep the scraping selectors in auth.js updated when Dianping redesigns.
- Retry once after a fresh navigation before giving up.
When it happens
Trigger: verifyDianpingIdentity loads /member/myinformation, passes the login-redirect check, but page.evaluate returns {user_id: ''} because no anchor matching a[href*='/member/'] with /member/\d+ exists in the DOM.
Common situations: Dianping redesigned the member page selectors; page still loading when evaluate runs (fixed 2s wait too short); logged-out or bot-challenge variant of the page rendered; regional/AB-tested layout without the profile link.
Related errors
- 无法获取简历面板:
- dianping could not resolve cityId for '${cityArg}' (pinyin=$
- dianping citylist did not render any city anchors; cannot re
- Google Scholar result cards were present but no rows could b
- google images returned an unexpected row shape.
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/44eb08d79f8209f1.
Report an issue: GitHub.