openai/codex · error · io::Error
path is not a regular file
Error message
path is not a regular file
What it means
Error "path is not a regular file" thrown in openai/codex.
Source
Thrown at codex-rs/exec-server/src/no_follow/unix.rs:108
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))
}
fn open_file_sync(path: &Path) -> io::Result<std::fs::File> {
let file = open_entry_sync(path)?;
if !file.metadata()?.is_file() {
return Err(io::Error::new(
io::ErrorKind::InvalidInput,
"path is not a regular file",
));
}
Ok(file)
}
pub(super) async fn open_file(path: PathBuf) -> io::Result<tokio::fs::File> {
tokio::task::spawn_blocking(move || open_file_sync(&path).map(tokio::fs::File::from_std))
.await
.map_err(|error| io::Error::other(format!("filesystem task failed: {error}")))?
}
pub(super) async fn write_file(path: PathBuf, contents: Vec<u8>) -> io::Result<()> {
tokio::task::spawn_blocking(move || {
let (parent, leaf) = parent(&path)?;
// Prevent FIFOs and devices from blocking during open before the
// descriptor can be validated as a regular file below.View on GitHub (pinned to 339751715c)
Solutions
- Point the operation at a regular file, not a directory or special file.
When it happens
Trigger: Thrown at codex-rs/exec-server/src/no_follow/unix.rs:108 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/c44b6cbb42bafb75.
Report an issue: GitHub.