jackwener/OpenCLI · error · ArgumentError
xueqiu comments received an invalid symbol: ${symbol}
Error message
xueqiu comments received an invalid symbol: ${symbol} What it means
When the first comments page is classified 'argument' — the JSON envelope text matches /invalid symbol|invalid code|bad symbol/ — throwFirstPageFailure throws ArgumentError with the offending symbol. The site itself rejected the ticker as invalid, even though it passed the CLI's local pattern check.
Source
Thrown at clis/xueqiu/comments.js:48
}
function normalizeIdentifier(value) {
if (typeof value === 'string')
return value.trim();
if (typeof value === 'number' && Number.isFinite(value))
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');
}View on GitHub (pinned to 49907e53dc)
Solutions
- Verify the symbol on xueqiu.com's website search and copy the exact ticker it uses
- Check prefix correctness: SH/SZ for A-shares, plain digits for HK (e.g. 00700), plain letters for US (e.g. AAPL)
- Try a well-known symbol like AAPL or SH600519 to confirm your session works and isolate the issue to the symbol
- If the symbol is valid on the site but still rejected, check for library updates — the API may have changed
Example fix
// before opencli xueqiu comments SH60051 // after opencli xueqiu comments SH600519
Defensive patterns
Strategy: validation
Validate before calling
const SYMBOL_RE = /^(?:[A-Z]{2}\d{5,6}|\d{4,6}|[A-Z]{1,5}(?:[.-][A-Z]{1,2})?)$/;
const symbol = String(raw).trim().toUpperCase();
if (!SYMBOL_RE.test(symbol)) throw new Error(`Invalid symbol format: ${symbol}`);
if (/^S[HZ]\d{5}$/.test(symbol)) throw new Error('A-share codes need 6 digits, e.g. SH600519'); Try / catch
try {
const rows = await fetchComments(symbol);
} catch (e) {
if (/invalid symbol/.test(e.message)) {
console.error(`Symbol ${symbol} rejected by xueqiu — check the ticker on xueqiu.com`);
} else throw e;
} Prevention
- Validate symbols against xueqiu's own site search before scripting
- Remember formats: SH/SZ + 6 digits (A-shares), 4-6 digits (HK), 1-5 letters (US)
- Watch for delisted/renamed tickers — valid-looking codes can be rejected
- Test with a known-good symbol (AAPL, SH600519) when debugging
When it happens
Trigger: `xueqiu comments <symbol>` where symbol matches the local regex but xueqiu's search/status API responds with an 'invalid symbol/code' error envelope — e.g. delisted tickers, wrong-market prefixes (SZ000001 vs SH600519 style mistakes), or US tickers xueqiu does not list.
Common situations: Typos like SH60051 (5 digits instead of 6); using an exchange prefix xueqiu does not recognize; querying a delisted or renamed stock; confusing Hong Kong 5-digit codes with A-share codes.
Related errors
- xueqiu/kline
- xueqiu/stock
- bbc topic "${args.topic}" is not supported
- bbc ${label} must be a positive integer
- bbc ${label} must be <= ${maxValue}
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/3add0622fef4c587.
Report an issue: GitHub.