openai/codex · error · std::io::Error

project layers are not ordered from root to cwd

Error message

project layers are not ordered from root to cwd

What it means

Error "project layers are not ordered from root to cwd" thrown in openai/codex.

Source

Thrown at codex-rs/config/src/state.rs:558

    for layer in layers {
        if let ConfigLayerSource::Project {
            dot_codex_folder: current_project_dot_codex_folder,
        } = &layer.name
        {
            if let Some(previous) = previous_project_dot_codex_folder {
                let Some(parent) = previous.as_path().parent() else {
                    return Err(std::io::Error::new(
                        std::io::ErrorKind::InvalidData,
                        "project layer has no parent directory",
                    ));
                };
                if previous == current_project_dot_codex_folder
                    || !current_project_dot_codex_folder
                        .as_path()
                        .ancestors()
                        .any(|ancestor| ancestor == parent)
                {
                    return Err(std::io::Error::new(
                        std::io::ErrorKind::InvalidData,
                        "project layers are not ordered from root to cwd",
                    ));
                }
            }
            previous_project_dot_codex_folder = Some(current_project_dot_codex_folder);
        }
    }

    Ok(())
}

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

View on GitHub (pinned to 339751715c)

Solutions

  1. Order the project config layers from filesystem root down to the current working directory.

When it happens

Trigger: Thrown at codex-rs/config/src/state.rs:558 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/6fffbf214c0f9e47. Report an issue: GitHub.