{"record":{"id":"ec3e0a97768a1cc1","repo":"jackwener/OpenCLI","slug":"xueqiu-comments-symbol","errorCode":null,"errorMessage":"xueqiu/comments ${symbol}","messagePattern":"xueqiu/comments (.+?)","errorType":"exception","errorClass":"EmptyResultError","httpStatus":null,"severity":"warning","filePath":"clis/xueqiu/comments.js","lineNumber":51,"sourceCode":"        return value.trim();\n    if (typeof value === 'number' && Number.isFinite(value))\n        return String(value);\n    return '';\n}\nfunction buildPaginationStopMessage(requestNumber, collected, target, reason) {\n    return `xueqiu comments pagination stopped after request ${requestNumber}, `\n        + `collected ${collected}/${target} items, `\n        + `reason: ${reason}`;\n}\nfunction throwFirstPageFailure(kind, symbol) {\n    if (kind === 'auth' || kind === 'anti-bot') {\n        throw new AuthRequiredError('xueqiu.com', 'Stock discussions require login or challenge clearance');\n    }\n    if (kind === 'argument') {\n        throw new ArgumentError(`xueqiu comments received an invalid symbol: ${symbol}`);\n    }\n    if (kind === 'empty') {\n        throw new EmptyResultError(`xueqiu/comments ${symbol}`, `No discussion data found for ${symbol}`);\n    }\n    throw new CommandExecutionError(`Unexpected response while loading xueqiu comments for ${symbol}`, 'Run the command again with --verbose to inspect the raw site response.');\n}\n/**\n * Extract the raw item list from one classified JSON payload.\n *\n * @param json Raw parsed JSON payload from browser fetch.\n * @returns Discussion items when the response shape is usable.\n */\nexport function getCommentItems(json) {\n    if (!isRecord(json))\n        return [];\n    const list = getCommentList(json) ?? [];\n    return list.filter((item) => !!item && typeof item === 'object');\n}\n/**\n * Classify one raw browser response before command-level error handling.\n *","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/xueqiu/comments.js#L33-L69","documentation":"When the first comments page is classified 'empty' — the envelope text matches no-data patterns or the list array is present but zero-length — throwFirstPageFailure throws EmptyResultError with resource `xueqiu/comments <symbol>` and message 'No discussion data found for <symbol>'. This is a normal, expected outcome: the query succeeded but there are no discussion posts for that ticker.","triggerScenarios":"`xueqiu comments <symbol>` where xueqiu returns a valid JSON envelope whose list (at json.list or json.data.list) is an empty array, or the envelope says no data / not found / no matching, on the first request.","commonSituations":"Querying obscure or thinly traded tickers with no discussion posts; querying during quiet market hours for illiquid stocks; a typo that happens to be a valid but nonexistent listing.","solutions":["Confirm the ticker is correct and active on xueqiu.com","Try a liquid symbol (e.g. SH600519, AAPL) to confirm the command works","Lower expectations — some stocks genuinely have zero discussions; treat EmptyResultError as success-with-no-rows in scripts","If a popular stock returns empty, re-login — a degraded session can yield filtered/empty results"],"exampleFix":"// before (assuming rows always exist)\nconst rows = await collectCommentRows(opts);\nconsole.log(rows[0].text);\n// after (handle empty)\nconst rows = await collectCommentRows(opts);\nif (rows.length === 0) console.log('No discussions for', opts.symbol);","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  const rows = await collectCommentRows(opts);\n} catch (e) {\n  if (e.name === 'EmptyResultError') {\n    rows = []; // no discussions for this symbol — valid outcome\n  } else throw e;\n}","preventionTips":["Treat EmptyResultError as a normal no-data outcome in scripts, not a crash","Check on xueqiu.com whether the stock actually has discussion posts","Prefer liquid tickers when testing pipelines","Combine with --limit awareness: sparse symbols return few or zero rows"],"tags":["empty-result","xueqiu","no-data"],"backgroundTag":"empty-result-set","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}