{"record":{"id":"fc6ebc193ffa24b3","repo":"jackwener/OpenCLI","slug":"jike-notifications-pagination-exceeded-max-pages","errorCode":null,"errorMessage":"Jike notifications pagination exceeded ${MAX_PAGES} pages before satisfying --limit","messagePattern":"Jike notifications pagination exceeded (.+?) pages before satisfying --limit","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"warning","filePath":"clis/jike/notifications.js","lineNumber":123,"sourceCode":"            rows.push(row);\n            if (rows.length >= limit) return rows;\n        }\n        const next = body.loadMoreKey;\n        if (next == null) {\n            if (rows.length === 0) throw new EmptyResultError('jike notifications', 'No notifications found');\n            return rows;\n        }\n        if (typeof next !== 'object' || Array.isArray(next)) {\n            throw new CommandExecutionError('Jike notifications API returned a malformed pagination cursor');\n        }\n        const cursorKey = JSON.stringify(next);\n        if (seenCursors.has(cursorKey)) {\n            throw new CommandExecutionError('Jike notifications pagination returned a repeated cursor');\n        }\n        seenCursors.add(cursorKey);\n        loadMoreKey = next;\n    }\n    throw new CommandExecutionError(`Jike notifications pagination exceeded ${MAX_PAGES} pages before satisfying --limit`);\n}\n\ncli({\n    site: 'jike',\n    name: 'notifications',\n    access: 'read',\n    description: '即刻通知',\n    domain: 'web.okjike.com',\n    strategy: Strategy.COOKIE,\n    browser: true,\n    args: [\n        { name: 'limit', type: 'int', default: DEFAULT_LIMIT },\n    ],\n    columns: ['type', 'user', 'content', 'time'],\n    func: async (page, kwargs) => {\n        const limit = normalizeJikeLimit(kwargs.limit, DEFAULT_LIMIT);\n        await page.goto('https://web.okjike.com/notification');\n        await requireJikeIdentity(page);","sourceCodeStart":105,"sourceCodeEnd":141,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/jike/notifications.js#L105-L141","documentation":"listNotifications caps fetching at MAX_PAGES pages. If --limit is not satisfied after MAX_PAGES iterations, it throws CommandExecutionError rather than fetching forever — protecting against unbounded requests when the feed is very large or pagination is broken.","triggerScenarios":"Calling `jike notifications` with a --limit larger than MAX_PAGES * PAGE_SIZE, or pagination stalling (small/empty pages) so the limit is never reached within the page cap.","commonSituations":"Requesting notifications for a very active account with a large --limit; a server-side page size reduction making MAX_PAGES insufficient; broken cursors yielding tiny pages.","solutions":["Lower the --limit value to something reachable within MAX_PAGES pages","Increase MAX_PAGES/PAGE_SIZE in the CLI config or source if you genuinely need more","Run the command incrementally (smaller limits repeatedly) to page through the feed","Check whether pagination is degraded (tiny pages) — see the repeated-cursor / malformed-cursor errors"],"exampleFix":"// before\njike notifications --limit 1000\n// after\njike notifications --limit 50","handlingStrategy":"validation","validationCode":"// keep the requested limit within what MAX_PAGES*PAGE_SIZE can deliver\nconst MAX_PAGES = 10, PAGE_SIZE = 20; // confirm actual values in the CLI\nif (limit > MAX_PAGES * PAGE_SIZE) {\n  throw new Error(`--limit ${limit} exceeds pagination cap ${MAX_PAGES * PAGE_SIZE}`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  await cli('jike', 'notifications', ['--limit', '50']).run();\n} catch (e) {\n  if (String(e.message).includes('pagination exceeded')) {\n    // fall back to the maximum achievable page count or fetch incrementally\n  } else throw e;\n}","preventionTips":["Keep --limit at or below MAX_PAGES * PAGE_SIZE","Fetch incrementally in batches instead of one huge request","Adjust MAX_PAGES in configuration/source if large pulls are genuinely needed"],"tags":["pagination","limit","jike"],"backgroundTag":"pagination-limit-exceeded","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}