jackwener/OpenCLI · error · CommandExecutionError
Twitter followers pagination exceeded ${MAX_PAGINATION_PAGES
Error message
Twitter followers pagination exceeded ${MAX_PAGINATION_PAGES} pages before cursor exhaustion What it means
CommandExecutionError thrown when the twitter followers command exhausts MAX_PAGINATION_PAGES (100) scroll/capture rounds while the row count is still below --limit and a continuation cursor still exists. This guards against unbounded pagination when Twitter keeps issuing cursors but the command cannot converge on the requested number of rows.
Source
Thrown at clis/twitter/followers.js:194
await consumeCaptured();
while (allFollowers.length < limit && cursor && pages < MAX_PAGINATION_PAGES) {
const beforeCount = allFollowers.length;
const beforeCursor = cursor;
await page.autoScroll({ times: 1, delayMs: 500 });
try {
await page.waitForCapture(CAPTURE_TIMEOUT_SECONDS);
}
catch {
throw new TimeoutError('twitter followers pagination', CAPTURE_TIMEOUT_SECONDS, `Twitter returned a continuation cursor after ${allFollowers.length} rows, but the next Followers response was not observed.`);
}
await consumeCaptured();
pages++;
if (allFollowers.length === beforeCount && cursor === beforeCursor) {
throw new CommandExecutionError('Twitter followers pagination repeated a cursor without returning new users');
}
}
if (allFollowers.length < limit && cursor && pages >= MAX_PAGINATION_PAGES) {
throw new CommandExecutionError(`Twitter followers pagination exceeded ${MAX_PAGINATION_PAGES} pages before cursor exhaustion`);
}
if (allFollowers.length === 0) {
if (looksLikePrivateTwitterTimeline(lastRawResponse)) {
throw new EmptyResultError('twitter followers', `No follower data returned for @${targetUser} (the target account may have set their followers list to private)`);
}
throw new EmptyResultError('twitter followers', `No followers found for @${targetUser}`);
}
return allFollowers.slice(0, limit);
}
});
export const __test__ = {
extractFollower,
normalizeScreenName,
parseFollowers,
twitterGraphqlError,
};
View on GitHub (pinned to 49907e53dc)
Solutions
- Lower --limit to a value achievable within 100 pages (e.g. 200–500).
- Re-run the command repeatedly and aggregate results externally if you genuinely need very large follower lists.
- Ensure a fast, stable network so each captured page delivers a full batch of users.
- Check whether X is rate-limiting the session; wait and retry with a fresh session.
Example fix
// before opencli twitter followers @elonmusk --limit 100000 // after opencli twitter followers @elonmusk --limit 500 # stay within the 100-page pagination budget
Defensive patterns
Strategy: validation
Validate before calling
const MAX_ROWS_PER_100_PAGES = 2000; // heuristic budget
if (limit > MAX_ROWS_PER_100_PAGES) {
throw new Error(`--limit ${limit} likely exceeds the 100-page pagination budget; use <= ${MAX_ROWS_PER_100_PAGES} or paginate manually`);
} Type guard
function isAchievableLimit(limit) { return Number.isInteger(limit) && limit > 0 && limit <= 2000; } Try / catch
try {
rows = await opencli.twitter.followers(user, { limit });
} catch (e) {
if (String(e.message).includes('exceeded') && String(e.message).includes('pages')) {
// fall back to a lower limit
rows = await opencli.twitter.followers(user, { limit: 500 });
} else throw e;
} Prevention
- Request realistic limits (hundreds, not tens of thousands)
- Aggregate multiple smaller runs if you need very large lists
- Keep pages progressing quickly (good network, focused tab)
- Monitor partial progress and persist incrementally
When it happens
Trigger: allFollowers.length < limit, a next cursor is still present, and pages >= 100 — i.e. the caller asked for more followers than 100 intercepted pages delivered (or progress was so slow the page cap hit first).
Common situations: Requesting --limit in the thousands (e.g. an account with millions of followers); very slow capture cycles causing each page to add few rows before the 100-page cap; X intermittently dropping pages so many rounds yield zero rows; aggressive rate limiting slowing delivery.
Related errors
- twitter_collection_limit_reached
- limit must be an integer between 1 and ${max}
- INVALID_LIMIT
- Jike notifications pagination exceeded ${MAX_PAGES} pages be
- juejin ${label} must be <= ${maxValue}
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/f0cf199f0352727b.
Report an issue: GitHub.