jackwener/OpenCLI · error · CommandExecutionError

Unexpected response while loading xueqiu comments for ${symb

Error message

Unexpected response while loading xueqiu comments for ${symbol}

What it means

Catch-all branch of throwFirstPageFailure: when the first comments page is classified 'incompatible' (JSON content type but no recognizable list shape) it falls through to CommandExecutionError 'Unexpected response while loading xueqiu comments for <symbol>' with the hint to re-run with --verbose. It means xueqiu answered with JSON that does not match the expected envelope, i.e. an API shape change or an unrecognized error payload.

Source

Thrown at clis/xueqiu/comments.js:53

        return String(value);
    return '';
}
function buildPaginationStopMessage(requestNumber, collected, target, reason) {
    return `xueqiu comments pagination stopped after request ${requestNumber}, `
        + `collected ${collected}/${target} items, `
        + `reason: ${reason}`;
}
function throwFirstPageFailure(kind, symbol) {
    if (kind === 'auth' || kind === 'anti-bot') {
        throw new AuthRequiredError('xueqiu.com', 'Stock discussions require login or challenge clearance');
    }
    if (kind === 'argument') {
        throw new ArgumentError(`xueqiu comments received an invalid symbol: ${symbol}`);
    }
    if (kind === 'empty') {
        throw new EmptyResultError(`xueqiu/comments ${symbol}`, `No discussion data found for ${symbol}`);
    }
    throw new CommandExecutionError(`Unexpected response while loading xueqiu comments for ${symbol}`, 'Run the command again with --verbose to inspect the raw site response.');
}
/**
 * Extract the raw item list from one classified JSON payload.
 *
 * @param json Raw parsed JSON payload from browser fetch.
 * @returns Discussion items when the response shape is usable.
 */
export function getCommentItems(json) {
    if (!isRecord(json))
        return [];
    const list = getCommentList(json) ?? [];
    return list.filter((item) => !!item && typeof item === 'object');
}
/**
 * Classify one raw browser response before command-level error handling.
 *
 * @param response Structured browser response payload.
 * @returns Tagged result describing the response class.

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Re-run with --verbose to inspect the raw site response and identify the new shape
  2. Re-login and retry — an unusual session state can produce unusual envelopes
  3. Retry later in case of a transient site-side change or A/B test
  4. If persistent, check for a library update; the response classifier likely needs the new schema

Example fix

// before
opencli xueqiu comments AAPL
// after (diagnose)
opencli xueqiu comments AAPL --verbose  # inspect raw JSON body
Defensive patterns

Strategy: retry

Try / catch

try {
  const rows = await collectCommentRows(opts);
} catch (e) {
  if (/Unexpected response while loading xueqiu comments/.test(e.message)) {
    console.error('Unknown JSON shape — re-run with --verbose to inspect raw response');
  } else throw e;
}

Prevention

When it happens

Trigger: First request to the search/status endpoint returns application/json that parses, but contains neither json.list nor json.data.list, and matches none of the auth/anti-bot/argument/empty text patterns.

Common situations: Xueqiu changing the /query/v1/symbol/search/status response schema; a new error envelope format the classifier does not know; CDN or proxy returning a JSON error page from a middlebox.

Related errors


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/0406a9b6447b9c92. Report an issue: GitHub.