openai/codex · error
failed to lock synthetic bubblewrap mount registry
Error message
failed to lock synthetic bubblewrap mount registry {}: {err} What it means
Taking the exclusive flock on the synthetic mount registry lock file failed. This panic in with_synthetic_mount_registry_lock fires when libc::flock(LOCK_EX) returns an error (e.g. EBADF, ENOLCK, or an interrupted lock on some filesystems like NFS without flock support), meaning concurrent cleanup serialization cannot be guaranteed and the registry operation aborts.
Solutions
- Check the io::Error errno in the message
- Avoid TMPDIR on filesystems lacking flock support (some network filesystems)
- Move the registry to a local filesystem via TMPDIR
- Retry if the error was transient (e.g. signal interruption)
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at codex-rs/linux-sandbox/src/linux_run_main.rs:1316 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/91041e896d999a5f.
Report an issue: GitHub.
Appendix: source
Thrown at codex-rs/linux-sandbox/src/linux_run_main.rs:1316
registry_root.display()
)
});
let lock_path = registry_root.join("lock");
let lock_file = OpenOptions::new()
.read(true)
.write(true)
.create(true)
.truncate(false)
.open(&lock_path)
.unwrap_or_else(|err| {
panic!(
"failed to open synthetic bubblewrap mount registry lock {}: {err}",
lock_path.display()
)
});
if unsafe { libc::flock(lock_file.as_raw_fd(), libc::LOCK_EX) } < 0 {
let err = std::io::Error::last_os_error();
panic!(
"failed to lock synthetic bubblewrap mount registry {}: {err}",
lock_path.display()
);
}
let result = f();
if unsafe { libc::flock(lock_file.as_raw_fd(), libc::LOCK_UN) } < 0 {
let err = std::io::Error::last_os_error();
panic!(
"failed to unlock synthetic bubblewrap mount registry {}: {err}",
lock_path.display()
);
}
result
}
fn synthetic_mount_marker_dir(path: &Path) -> PathBuf {
synthetic_mount_registry_root().join(format!("{:016x}", hash_path(path)))
}View on GitHub (pinned to 339751715c)