openai/codex · error · io::Error
directory already exists
Error message
directory already exists
What it means
Error "directory already exists" thrown in openai/codex.
Source
Thrown at codex-rs/exec-server/src/no_follow/unix.rs:264
fn unix_time_ms(seconds: i64, nanoseconds: impl TryInto<i64>) -> i64 {
let nanoseconds = nanoseconds.try_into().unwrap_or_default();
seconds
.saturating_mul(1_000)
.saturating_add(nanoseconds / 1_000_000)
}
pub(super) async fn metadata(path: PathBuf) -> io::Result<FileMetadata> {
tokio::task::spawn_blocking(move || metadata_sync(&path))
.await
.map_err(|error| io::Error::other(format!("filesystem task failed: {error}")))?
}
pub(super) async fn create_directory(path: PathBuf, recursive: bool) -> io::Result<()> {
tokio::task::spawn_blocking(move || {
let components = components(&path)?;
if components.is_empty() && !recursive {
return Err(io::Error::new(
io::ErrorKind::AlreadyExists,
"directory already exists",
));
}
let mut directory = root()?;
for (index, component) in components.iter().enumerate() {
let is_leaf = index + 1 == components.len();
if !recursive && is_leaf {
mkdirat(&directory, component, Mode::from_raw_mode(0o777))
.map_err(io::Error::from)?;
return Ok(());
}
match open_directory(&directory, component) {
Ok(next) => directory = next,
Err(error) if recursive && error.kind() == io::ErrorKind::NotFound => {
match mkdirat(&directory, component, Mode::from_raw_mode(0o777)) {
Ok(()) | Err(rustix::io::Errno::EXIST) => {}
Err(error) => return Err(io::Error::from(error)),View on GitHub (pinned to 339751715c)
When it happens
Trigger: Thrown at codex-rs/exec-server/src/no_follow/unix.rs:264 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/bd426fb97a0a7547.
Report an issue: GitHub.