openai/codex · error · io::Error

path must name an entry

Error message

path must name an entry

What it means

Error "path must name an entry" thrown in openai/codex.

Source

Thrown at codex-rs/exec-server/src/no_follow/unix.rs:85

    )
    .map_err(io::Error::from)
}

fn open_directory(parent: &OwnedFd, name: &OsString) -> io::Result<OwnedFd> {
    openat(
        parent,
        name,
        directory_access_flags() | OFlags::DIRECTORY | OFlags::NOFOLLOW | OFlags::CLOEXEC,
        Mode::empty(),
    )
    .map_err(io::Error::from)
}

fn parent(path: &Path) -> io::Result<(OwnedFd, OsString)> {
    let mut components = components(path)?;
    let leaf = components
        .pop()
        .ok_or_else(|| io::Error::new(io::ErrorKind::InvalidInput, "path must name an entry"))?;
    let mut directory = root()?;
    for component in components {
        directory = open_directory(&directory, &component)?;
    }
    Ok((directory, leaf))
}

fn open_entry_sync(path: &Path) -> io::Result<std::fs::File> {
    let (parent, leaf) = parent(path)?;
    let file = openat(
        &parent,
        leaf,
        OFlags::RDONLY | OFlags::NOFOLLOW | OFlags::NONBLOCK | OFlags::CLOEXEC,
        Mode::empty(),
    )
    .map_err(io::Error::from)?;
    Ok(std::fs::File::from(file))
}

View on GitHub (pinned to 339751715c)

Solutions

  1. Remove the trailing slash; the path must name an entry.

When it happens

Trigger: Thrown at codex-rs/exec-server/src/no_follow/unix.rs:85 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/8cb2edab01492a1b. Report an issue: GitHub.