jackwener/OpenCLI · warning

xueqiu comments pagination stopped after request ${requestNu

Error message

xueqiu comments pagination stopped after request ${requestNumber}, collected ${collected}/${target} items, reason: ${reason}

What it means

During xueqiu comment collection, pagination stopped early because a page request was classified as a recoverable failure (not 'empty', not 'unknown'). The command warns with the request number, items collected vs target, and the classified reason, then returns what it has instead of throwing (first-page failures still throw).

Source

Thrown at clis/xueqiu/comments.js:257

 *
 * @param options Pagination inputs and a page-fetch callback.
 * @returns Deduplicated normalized rows, possibly partial with a warning.
 */
export async function collectCommentRows(options) {
    const warn = options.warn ?? log.warn;
    let rows = [];
    const seenIds = new Set();
    for (let requestNumber = 1; requestNumber <= options.maxRequests; requestNumber += 1) {
        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))

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Read `reason` in the message and address it (e.g., wait out rate limit, refresh login cookies)
  2. Lower --limit so the target is reachable before the failure point
  3. Rerun the command later to collect remaining comments, or retry with backoff
  4. Ensure a valid authenticated Xueqiu session if the reason indicates an auth wall
  5. Check the symbol id is valid — partially valid symbols sometimes serve only the first pages

Example fix

// before: limit too high, stopped at rate limit after 3 pages (60/500)
opencli xueqiu comments --symbol SH600000 --limit 500
// after: smaller limit + valid session
opencli xueqiu comments --symbol SH600000 --limit 50
Defensive patterns

Strategy: retry

Validate before calling

// Pre-flight: ensure a live session and a sane limit
if (!await hasValidXueqiuSession()) throw new Error('Login required');
if (options.limit > 200) console.warn('Large limits often stop early due to rate limits');

Try / catch

try {
  const rows = await xueqiuComments(symbol, { limit });
  if (rows.length < limit) {
    console.warn(`Partial: ${rows.length}/${limit}`); // parse the stop reason from stderr
  }
} catch (err) {
  // first-page failures throw; back off and retry later
}

Prevention

When it happens

Trigger: collectCommentRows loops requesting comment pages; a non-first page's classify() result is a known failure kind (e.g., rate-limit, auth-wall, server error), triggering warn(buildPaginationStopMessage(...)) and a break.

Common situations: Xueqiu rate limiting or temporary 4xx/5xx on comments API after several pages, symbol requiring login for older comments, token/cookie expiry mid-pagination, requesting very large limits (target far beyond free pages).

Related errors


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