jackwener/OpenCLI · error · ArgumentError

xueqiu comments supports --limit up to 100

Error message

xueqiu comments supports --limit up to 100

What it means

The xueqiu comments command caps the number of fetched comments at 100. If --limit exceeds 100, an ArgumentError is thrown because the scraper's pagination strategy (pageSize 20, maxRequests 5) can collect at most 100 rows per run.

Source

Thrown at clis/xueqiu/comments.js:323

    navigateBefore: false,
    args: [
        {
            name: 'symbol',
            positional: true,
            required: true,
            help: 'Stock symbol, e.g. SH600519, AAPL, or 00700',
        },
        { name: 'limit', type: 'int', default: 20, help: 'Number of discussion posts to return' },
    ],
    columns: ['author', 'text', 'likes', 'replies', 'retweets', 'created_at', 'url'],
    func: async (page, args) => {
        const symbol = normalizeSymbolInput(args.symbol);
        const limit = Number(args.limit);
        if (!Number.isInteger(limit) || limit <= 0) {
            throw new ArgumentError('xueqiu comments requires --limit to be a positive integer');
        }
        if (limit > 100) {
            throw new ArgumentError('xueqiu comments supports --limit up to 100');
        }
        const pageSize = Math.min(limit, 20);
        await page.goto('https://xueqiu.com');
        const rows = await collectCommentRows({
            symbol,
            limit,
            pageSize,
            maxRequests: 5,
            fetchPage: (pageNumber, currentPageSize) => fetchCommentsPage(page, symbol, pageNumber, currentPageSize),
            warn: log.warn,
        });
        return rows.map(row => toCommentOutputRow(row));
    },
});
/**
 * Convert raw CLI input into a normalized stock symbol.
 *
 * @param raw User-provided CLI argument.

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Reduce --limit to at most 100.
  2. Paginate manually: run the command multiple times if you need more than 100 comments (the API only exposes limited pages anyway).
  3. Clamp the value in scripts: --limit "$(( LIMIT > 100 ? 100 : LIMIT ))".

Example fix

// before
clis/xueqiu comments AAPL --limit 500
// after
clis/xueqiu comments AAPL --limit 100
Defensive patterns

Strategy: validation

Validate before calling

const limit = Number(rawLimit);
if (Number.isInteger(limit) && limit > 100) {
  limit = 100; // clamp instead of failing
}

Prevention

When it happens

Trigger: Running the xueqiu comments command with --limit greater than 100, e.g. --limit 500 or --limit 1000.

Common situations: Users assuming unlimited scraping like other tools, trying to backfill a long discussion thread in one call, or scripts computing a large limit from a target row count.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


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