openai/codex · error

failed to remove synthetic bubblewrap mount marker directory

Error message

failed to remove synthetic bubblewrap mount marker directory {}: {err}

What it means

Removing the marker directory for a synthetic mount failed during cleanup. This panic in cleanup_synthetic_mount_targets fires when fs::remove_dir on the marker dir errors with something other than NotFound or DirectoryNotEmpty — i.e. the directory is empty and dead but still cannot be removed (permissions or IO failure), blocking full cleanup of the synthetic mount scaffolding.

Solutions

  1. Check the io::Error errno in the message
  2. Verify ownership/permissions of the marker directory under the registry root
  3. Manually clean the synthetic mount registry temp directory once the sandbox is idle
  4. Report as a bug if the directory is removable by hand
Defensive patterns

Strategy: try-catch

When it happens

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

Appendix: source

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

                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()
                ),
            }
        }
    });
}

fn cleanup_protected_create_targets(targets: &[ProtectedCreateTargetRegistration]) -> bool {
    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 protected create target {}: {err}",
                    target.target.path().display()
                ),

View on GitHub (pinned to 339751715c)