openai/codex · error

{method} returned a pagination cursor exceeding {MAX_MCP_PAG

Error message

{method} returned a pagination cursor exceeding {MAX_MCP_PAGINATION_CURSOR_BYTES} bytes

What it means

Error "{method} returned a pagination cursor exceeding {MAX_MCP_PAGINATION_CURSOR_BYTES} bytes" thrown in openai/codex.

Source

Thrown at codex-rs/codex-mcp/src/pagination.rs:65

                ));
            }
            page_count += 1;
            let params = cursor.as_ref().map(|next: &String| {
                PaginatedRequestParams::default().with_cursor(Some(next.clone()))
            });
            let (items, next_cursor) = fetch(params).await?;
            if items.len() > max_items.saturating_sub(collected.len()) {
                return Err(anyhow!(
                    "{method} exceeded the catalog limit of {max_items} items"
                ));
            }
            collected.extend(items);

            let Some(next_cursor) = next_cursor else {
                return Ok(collected);
            };
            if next_cursor.len() > MAX_MCP_PAGINATION_CURSOR_BYTES {
                return Err(anyhow!(
                    "{method} returned a pagination cursor exceeding {MAX_MCP_PAGINATION_CURSOR_BYTES} bytes"
                ));
            }
            if !seen_cursors.insert(next_cursor.clone()) {
                return Err(anyhow!("{method} returned a repeated pagination cursor"));
            }
            cursor = Some(next_cursor);
        }
    };

    let timeout = overall_timeout.unwrap_or(DEFAULT_MCP_PAGINATION_TIMEOUT);
    tokio::time::timeout(timeout, collect)
        .await
        .map_err(|_| anyhow!("{method} pagination timed out after {timeout:?}"))?
}

#[cfg(test)]
#[path = "pagination_tests.rs"]

View on GitHub (pinned to 339751715c)

Solutions

  1. Fix the MCP server to return compact pagination cursors under the byte limit.

When it happens

Trigger: Thrown at codex-rs/codex-mcp/src/pagination.rs:65 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of openai/codex@339751715c (2026-08-25). Data as JSON: /api/errors/054c7acccc3dd6ea. Report an issue: GitHub.