openai/codex · error · anyhow::Error

invalid project cursor

Error message

invalid project cursor: {cursor}

What it means

The pagination cursor could not be parsed. Cursors are expected in the exact form '<position>|<uuid>' with a non-negative canonical integer and a canonical lowercase UUID string; any missing component, extra segment, leading zeros/whitespace, non-numeric position, or non-canonical UUID triggers invalid_project_cursor.

Solutions

  1. Use the verbatim next_cursor returned by the previous list_projects page
  2. Start a fresh listing with no cursor after corruption
  3. Regenerate the cursor from a known position and project id in canonical form
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at codex-rs/state/src/runtime/projects.rs:487 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/881b81ea923c5817. Report an issue: GitHub.

Appendix: source

Thrown at codex-rs/state/src/runtime/projects.rs:487

    let mut parts = cursor.split('|');
    let position_component = parts.next().ok_or_else(|| invalid_project_cursor(cursor))?;
    let position: i64 = position_component
        .parse()
        .map_err(|_| invalid_project_cursor(cursor))?;
    let id = parts.next().ok_or_else(|| invalid_project_cursor(cursor))?;
    let uuid = Uuid::parse_str(id).map_err(|_| invalid_project_cursor(cursor))?;
    if parts.next().is_some()
        || position < 0
        || position.to_string() != position_component
        || uuid.to_string() != id
    {
        return Err(invalid_project_cursor(cursor));
    }
    Ok((position, id.to_string()))
}

fn invalid_project_cursor(cursor: &str) -> anyhow::Error {
    anyhow::anyhow!("invalid project cursor: {cursor}")
}

#[cfg(test)]
#[path = "projects_tests.rs"]
mod tests;

View on GitHub (pinned to 339751715c)