openai/codex · error
failed to unlock synthetic bubblewrap mount registry
Error message
failed to unlock synthetic bubblewrap mount registry {}: {err} What it means
Releasing the exclusive flock on the synthetic mount registry failed after the guarded operation completed. This panic in with_synthetic_mount_registry_lock fires when flock(LOCK_UN) errors — fd already closed, or filesystem-level lock trouble — indicating the lock's lifecycle was violated; the lock file closes afterwards, but the inconsistency is treated as fatal to expose fd-management bugs.
Solutions
- Inspect the io::Error errno to identify the unlock failure
- Verify no code path closes the lock fd before unlocking
- Report as a bug with filesystem details if errno is unexpected
- Retry the sandboxed command to see if it was transient
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at codex-rs/linux-sandbox/src/linux_run_main.rs:1324 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/d4cebda200245457.
Report an issue: GitHub.
Appendix: source
Thrown at codex-rs/linux-sandbox/src/linux_run_main.rs:1324
.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)))
}
pub(crate) fn synthetic_mount_registry_root() -> PathBuf {
static REGISTRY_ROOT: OnceLock<PathBuf> = OnceLock::new();
REGISTRY_ROOT
.get_or_init(|| {
let effective_uid = unsafe { libc::geteuid() };
let temp_dir = std::env::temp_dir();View on GitHub (pinned to 339751715c)