openai/codex · error
failed to remove synthetic bubblewrap mount target
Error message
failed to remove synthetic bubblewrap mount target {}: {err} What it means
Deleting a synthetic mount target that was registered for bwrap failed during cleanup. This panic in remove_synthetic_mount_target fires after should_remove_after_bwrap approved removal but the actual remove operation (unlink/rmdir depending on target kind) errored — meaning the empty-file or directory scaffold bwrap bind-mounted cannot be torn down, possibly leaving stray files behind.
Solutions
- Inspect the io::Error embedded in the message
- Verify the synthetic target path is writable/removable by the current uid
- Check for processes still holding the path open (delay unlink on some filesystems)
- Manually clean leftover synthetic mount targets once idle
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at codex-rs/linux-sandbox/src/linux_run_main.rs:1267 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/ebc8c20ba9fb9967.
Report an issue: GitHub.
Appendix: source
Thrown at codex-rs/linux-sandbox/src/linux_run_main.rs:1267
fn remove_synthetic_mount_target(target: &crate::bwrap::SyntheticMountTarget) {
let path = target.path();
let metadata = match fs::symlink_metadata(path) {
Ok(metadata) => metadata,
Err(err) if err.kind() == std::io::ErrorKind::NotFound => return,
Err(err) => panic!(
"failed to inspect synthetic bubblewrap mount target {}: {err}",
path.display()
),
};
if !target.should_remove_after_bwrap(&metadata) {
return;
}
match target.kind() {
crate::bwrap::SyntheticMountTargetKind::EmptyFile => match fs::remove_file(path) {
Ok(()) => {}
Err(err) if err.kind() == std::io::ErrorKind::NotFound => {}
Err(err) => panic!(
"failed to remove synthetic bubblewrap mount target {}: {err}",
path.display()
),
},
crate::bwrap::SyntheticMountTargetKind::EmptyDirectory => match fs::remove_dir(path) {
Ok(()) => {}
Err(err) if err.kind() == std::io::ErrorKind::NotFound => {}
Err(err) if err.kind() == std::io::ErrorKind::DirectoryNotEmpty => {}
Err(err) => panic!(
"failed to remove synthetic bubblewrap mount target {}: {err}",
path.display()
),
},
}
}
fn process_is_active(pid: libc::pid_t) -> bool {
let result = unsafe { libc::kill(pid, 0) };View on GitHub (pinned to 339751715c)