openai/codex · error

failed to unregister synthetic bubblewrap mount target

Error message

failed to unregister synthetic bubblewrap mount target {}: {err}

What it means

Unregistering a synthetic bubblewrap mount target failed during cleanup after bwrap exits. This panic in cleanup_synthetic_mount_targets fires when removing the target's marker file errors with anything other than NotFound — the cleanup holds the registry lock, so this indicates filesystem-level trouble (permissions, IO errors) rather than concurrency.

Solutions

  1. Inspect the io::Error in the message for the errno
  2. Verify the registry temp directory and marker files are writable by the current uid
  3. Clear leftover marker files from the registry root if they are stale
  4. Check disk health if IO errors persist
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at codex-rs/linux-sandbox/src/linux_run_main.rs:1102 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/80ca7e51fd26f486. Report an issue: GitHub.

Appendix: source

Thrown at codex-rs/linux-sandbox/src/linux_run_main.rs:1102

                ),
            }
            continue;
        }
        let matches_marker = matches_marker(&path);
        if matches_marker {
            return true;
        }
    }
    false
}

fn cleanup_synthetic_mount_targets(targets: &[SyntheticMountTargetRegistration]) {
    with_synthetic_mount_registry_lock(|| {
        for target in targets.iter().rev() {
            match fs::remove_file(&target.marker_file) {
                Ok(()) => {}
                Err(err) if err.kind() == std::io::ErrorKind::NotFound => {}
                Err(err) => panic!(
                    "failed to unregister synthetic bubblewrap mount target {}: {err}",
                    target.target.path().display()
                ),
            }
        }

        for target in targets.iter().rev() {
            if synthetic_mount_marker_dir_has_active_process(&target.marker_dir) {
                continue;
            }
            remove_synthetic_mount_target(&target.target);
            match fs::remove_dir(&target.marker_dir) {
                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 marker directory {}: {err}",
                    target.marker_dir.display()

View on GitHub (pinned to 339751715c)