jackwener/OpenCLI · error · CommandExecutionError
Unexpected response while loading xueqiu comments for ${opti
Error message
Unexpected response while loading xueqiu comments for ${options.symbol} What it means
In collectCommentRows, if the first page classifies as 'unknown' but yields zero normalized rows (no items with an id), the command throws CommandExecutionError 'Unexpected response while loading xueqiu comments for <symbol>'. This differs from 4948: the classifier could not categorize the response AND item extraction found nothing usable, so the command fails hard rather than returning empty.
Source
Thrown at clis/xueqiu/comments.js:266
const response = await options.fetchPage(requestNumber, options.pageSize);
const classified = classifyXueqiuCommentsResponse(response);
if (requestNumber === 1 && classified.kind !== 'unknown') {
throwFirstPageFailure(classified.kind, options.symbol);
}
else if (classified.kind === 'empty') {
break;
}
else if (classified.kind !== 'unknown') {
warn(buildPaginationStopMessage(requestNumber, rows.length, options.limit, describeFailureKind(classified.kind)));
break;
}
const rawItems = getCommentItems(response.json);
const pageRows = rawItems
.map(item => normalizeCommentItem(item))
.filter(row => row.id);
if (pageRows.length === 0) {
if (requestNumber === 1) {
throw new CommandExecutionError(`Unexpected response while loading xueqiu comments for ${options.symbol}`, 'Run the command again with --verbose to inspect the raw site response.');
}
if (classified.kind === 'unknown') {
warn(buildPaginationStopMessage(requestNumber, rows.length, options.limit, describeFailureKind(classified.kind)));
}
break;
}
let advanced = false;
for (const row of pageRows) {
if (seenIds.has(row.id))
continue;
seenIds.add(row.id);
rows.push(row);
advanced = true;
}
if (rows.length >= options.limit) {
return rows.slice(0, options.limit);
}
if (rawItems.length < options.pageSize) {View on GitHub (pinned to 49907e53dc)
Solutions
- Re-run with --verbose to see the raw first response (a status 0 means the in-page fetch threw — check connectivity/proxy)
- Re-login to xueqiu and retry to rule out session-related filtering
- Try a different liquid symbol to distinguish symbol-specific from systemic issues
- If items consistently lack ids, the site schema changed — check for a library update
Example fix
// before (crashing the whole command on a transient first-page failure)
const rows = await collectCommentRows(opts); // throws
// after (retry once at the caller)
let rows;
try { rows = await collectCommentRows(opts); }
catch (e) { rows = await collectCommentRows(opts); } Defensive patterns
Strategy: retry
Validate before calling
const cookies = await page.getCookies({ url: 'https://xueqiu.com' });
if (!cookies.some(c => c.name === 'xq_a_token' && c.value)) {
throw new Error('Login to xueqiu before fetching comments');
}
// also confirm network reachability to xueqiu.com from the browser Try / catch
try {
const rows = await collectCommentRows(opts);
} catch (e) {
if (/Unexpected response while loading xueqiu comments/.test(e.message)) {
await new Promise(r => setTimeout(r, 3000));
return collectCommentRows(opts); // single retry for transient first-page failures
}
throw e;
} Prevention
- Ensure stable network/proxy access to xueqiu.com from the automation browser
- Login and verify before fetching so sessions are healthy
- Use --verbose to distinguish status-0 fetch failures from schema changes
- Retry once on first-page failures; persistent failures need raw-response inspection
When it happens
Trigger: First fetchPage call returns a response whose classifyXueqiuCommentsResponse result is 'unknown' (e.g. status 0 from an in-page fetch exception, or JSON whose list contains only items without ids), so getCommentItems/normalizeCommentItem produce zero rows with requestNumber === 1.
Common situations: Network failure inside the browser (status 0 with the error message as textSnippet); a page of items that all lack an `id` field after a site schema change; JSON present but list items are strings/null instead of objects.
Related errors
- LinkedIn messaging API returned an unexpected response:
- unexpected /auth/me result: ${JSON.stringify(r)}
- exception
- Unexpected response while loading xueqiu comments for ${symb
- HTTP ${code}
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/881179ccc6f9cc8e.
Report an issue: GitHub.