jackwener/OpenCLI · error · CommandExecutionError
Jike search pagination exceeded ${MAX_PAGES} pages before sa
Error message
Jike search pagination exceeded ${MAX_PAGES} pages before satisfying --limit What it means
searchPosts caps pagination at MAX_PAGES (50) iterations to bound API calls. If --limit demands more rows than 50 pages of ~20 results can supply — or cursors keep coming without enough ORIGINAL_POST rows — it throws CommandExecutionError. This prevents unbounded crawling of the Jike search endpoint.
Source
Thrown at clis/jike/search.js:69
rows.push(row);
if (rows.length >= limit) return rows;
}
const next = body.loadMoreKey;
if (next == null) {
if (rows.length === 0) throw new EmptyResultError('jike search', `No posts found for "${keyword}"`);
return rows;
}
if (typeof next !== 'object' || Array.isArray(next)) {
throw new CommandExecutionError('Jike search API returned a malformed pagination cursor');
}
const cursorKey = JSON.stringify(next);
if (seenCursors.has(cursorKey)) {
throw new CommandExecutionError('Jike search pagination returned a repeated cursor');
}
seenCursors.add(cursorKey);
loadMoreKey = next;
}
throw new CommandExecutionError(`Jike search pagination exceeded ${MAX_PAGES} pages before satisfying --limit`);
}
cli({
site: 'jike',
name: 'search',
access: 'read',
description: '搜索即刻帖子',
domain: 'web.okjike.com',
strategy: Strategy.COOKIE,
browser: true,
args: [
{ name: 'query', type: 'string', required: true, positional: true, help: '即刻搜索关键词' },
{ name: 'limit', type: 'int', default: DEFAULT_LIMIT },
],
columns: ['id', 'author', 'content', 'likes', 'comments', 'time', 'url'],
func: async (page, kwargs) => {
const keyword = String(kwargs.query || '').trim();
if (!keyword) throw new ArgumentError('Jike search query cannot be empty');View on GitHub (pinned to 49907e53dc)
Solutions
- Lower --limit to a value the search can actually supply (e.g. 100 or fewer).
- Catch the error and use whatever partial data you collected, or drop the limit.
- Raise MAX_PAGES locally if you genuinely need deeper paging and accept the API load.
- Narrow the keyword so result pages contain a higher share of ORIGINAL_POST items.
Example fix
// before const rows = await runCli(['jike', 'search', keyword, '--limit', '2000']); // after const rows = await runCli(['jike', 'search', keyword, '--limit', '100']); // within MAX_PAGES * PAGE_SIZE
Defensive patterns
Strategy: validation
Validate before calling
// enforce a feasible limit before calling const MAX_FEASIBLE = 50 * 20; // MAX_PAGES * PAGE_SIZE if (requested > MAX_FEASIBLE) requested = MAX_FEASIBLE;
Try / catch
try {
return await runCli(['jike', 'search', keyword, '--limit', n]);
} catch (e) {
if (/pagination exceeded/.test(e.message)) return runCli(['jike', 'search', keyword, '--limit', 100]);
throw e;
} Prevention
- Keep --limit well under MAX_PAGES * PAGE_SIZE (1000).
- Prefer narrower keywords so pages contain more ORIGINAL_POST rows.
- Treat the error as 'asked for too many results', not an outage.
When it happens
Trigger: rows.length never reaches --limit within 50 page requests, e.g. --limit set extremely high (1000+) or the search returns mostly non-ORIGINAL_POST items (comments, topics) that get filtered out.
Common situations: User passes an oversized --limit expecting more results than Jike will serve; keyword results dominated by non-original-post result types; Page size (PAGE_SIZE=20) reduced server-side so 50 pages no longer suffice.
Related errors
- ${label} must be <= ${maxValue}
- coingecko limit must be <= 250 (per_page upper bound)
- No notifications found
- Jike notifications API returned a malformed pagination curso
- Jike notifications pagination returned a repeated cursor
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/00dd4b0ecc1d211c.
Report an issue: GitHub.