{"record":{"id":"55701acc5e3deb6f","repo":"openai/codex","slug":"method-exceeded-the-pagination-limit-of-max-mcp","errorCode":null,"errorMessage":"{method} exceeded the pagination limit of {MAX_MCP_CATALOG_PAGES} pages","messagePattern":"(.+?) exceeded the pagination limit of (.+?) pages","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"codex-rs/codex-mcp/src/pagination.rs","lineNumber":45,"sourceCode":"pub(crate) async fn collect_paginated_with_limit<T, F, Fut>(\n    method: &str,\n    overall_timeout: Option<Duration>,\n    max_items: usize,\n    mut fetch: F,\n) -> Result<Vec<T>>\nwhere\n    F: FnMut(Option<PaginatedRequestParams>) -> Fut,\n    Fut: Future<Output = Result<(Vec<T>, Option<String>)>>,\n{\n    let collect = async {\n        let mut collected = Vec::new();\n        let mut cursor = None;\n        let mut seen_cursors = HashSet::new();\n        let mut page_count = 0;\n\n        loop {\n            if page_count == MAX_MCP_CATALOG_PAGES {\n                return Err(anyhow!(\n                    \"{method} exceeded the pagination limit of {MAX_MCP_CATALOG_PAGES} pages\"\n                ));\n            }\n            page_count += 1;\n            let params = cursor.as_ref().map(|next: &String| {\n                PaginatedRequestParams::default().with_cursor(Some(next.clone()))\n            });\n            let (items, next_cursor) = fetch(params).await?;\n            if items.len() > max_items.saturating_sub(collected.len()) {\n                return Err(anyhow!(\n                    \"{method} exceeded the catalog limit of {max_items} items\"\n                ));\n            }\n            collected.extend(items);\n\n            let Some(next_cursor) = next_cursor else {\n                return Ok(collected);\n            };","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/openai/codex/blob/339751715c64496cb86246bfb3935f40e309dd3d/codex-rs/codex-mcp/src/pagination.rs#L27-L63","documentation":"Error \"{method} exceeded the pagination limit of {MAX_MCP_CATALOG_PAGES} pages\" thrown in openai/codex.","triggerScenarios":"Thrown at codex-rs/codex-mcp/src/pagination.rs:45 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Narrow the listing request (filters or prefixes) so fewer pages are needed; the server may also be misbehaving by returning unbounded pages."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"339751715c64496cb86246bfb3935f40e309dd3d","analyzedAt":"2026-08-25T05:35:09.876Z","schemaVersion":2},"datasetVersion":"2026-08-25T06:17:31.827Z"}