jackwener/OpenCLI · error · CommandExecutionError
exception
Error message
exception
What it means
The in-page probe wraps its whole fetch in try/catch and returns { kind: 'exception', detail }; verifyXueqiuIdentity converts that into CommandExecutionError 'xueqiu whoami failed: <detail>'. It means the identity probe itself crashed in the browser — network failure, CORS, JSON parse failure, or a page context issue — rather than xueqiu answering with an error.
Source
Thrown at clis/xueqiu/auth.js:45
return { kind: 'auth', detail: 'xueqiu portfolio API error_code 60201 用户id无效 — anonymous' };
}
if (d?.error_code) {
return { kind: 'xq-error', errorCode: d.error_code, detail: d.error_description || 'xueqiu API error' };
}
const uCookie = document.cookie.split('; ').find(c => c.startsWith('u='))?.split('=')[1] || '';
const cookiesuCookie = document.cookie.split('; ').find(c => c.startsWith('cookiesu='))?.split('=')[1] || '';
if (!uCookie || uCookie === cookiesuCookie) {
return { kind: 'auth', detail: 'xueqiu u cookie equals cookiesu (device id) — anonymous despite portfolio API 200' };
}
return { ok: true, user_id: uCookie };
} catch (e) {
return { kind: 'exception', detail: String(e && e.message || e) };
}
})()`);
if (probe?.kind === 'auth') throw new AuthRequiredError('xueqiu.com', probe.detail);
if (probe?.kind === 'http') throw new CommandExecutionError(`HTTP ${probe.httpStatus} from xueqiu stock API: ${probe.detail || ''}`);
if (probe?.kind === 'xq-error') throw new CommandExecutionError(`xueqiu API error_code ${probe.errorCode}: ${probe.detail}`);
if (probe?.kind === 'exception') throw new CommandExecutionError(`xueqiu whoami failed: ${probe.detail}`);
if (!probe?.ok) throw new CommandExecutionError(`Unexpected xueqiu probe: ${JSON.stringify(probe)}`);
return { user_id: String(probe.user_id) };
}
registerSiteAuthCommands({
site: 'xueqiu',
domain: 'xueqiu.com',
loginUrl: 'https://xueqiu.com/',
columns: ['user_id'],
quickCheck: hasXueqiuAccessToken,
verify: verifyXueqiuIdentity,
poll: async (page) => {
if (!await hasXueqiuAccessToken(page)) {
throw new AuthRequiredError('xueqiu.com', 'Waiting for Xueqiu xq_a_token cookie');
}
return verifyXueqiuIdentity(page);
},
});View on GitHub (pinned to 49907e53dc)
Solutions
- Check network connectivity and proxy settings for the automation browser
- Visit https://xueqiu.com/ in the browser first so the origin/context is stable, then re-run verify
- Re-run with --verbose to see the exception detail string
- If detail mentions JSON parsing, the API may be returning HTML — complete any challenge then retry
Defensive patterns
Strategy: try-catch
Type guard
function isExceptionProbe(p) {
return !!p && typeof p === 'object' && p.kind === 'exception' && typeof p.detail === 'string';
} Try / catch
try {
await verifyXueqiuIdentity(page);
} catch (e) {
if (e.message.startsWith('xueqiu whoami failed')) {
console.error('In-page probe crashed:', e.message);
// check network/proxy, navigate to xueqiu.com, then retry
} else throw e;
} Prevention
- Verify network/DNS/proxy reachability to stock.xueqiu.com before running
- Navigate to https://xueqiu.com/ before verify so the page context is stable
- Avoid closing or navigating the automation browser mid-probe
- Use --verbose to capture the underlying exception detail
When it happens
Trigger: page.evaluate's fetch throws inside the browser: network outage, DNS failure, aborted request, res.json() parse error on a non-JSON 200 body, or the evaluate script erroring.
Common situations: Running in an offline/proxy-restricted environment; xueqiu returning HTML with 200 so res.json() throws; browser page navigated/closed mid-probe; corporate proxy blocking stock.xueqiu.com.
Related errors
- subreddit-info failed: ${result.detail}
- Twitter device-follow fetch failed: ${data.detail || 'unknow
- ${label} failed: ${error?.message ?? error}
- Barchart greeks request failed: ${data.message || 'unknown e
- Claude whoami failed: ${result.detail}
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/1c6f4cd861423d34.
Report an issue: GitHub.