openai/codex · error

failed to inspect synthetic bubblewrap mount target

Error message

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

What it means

Stat-ing a synthetic bubblewrap mount target with symlink_metadata failed unexpectedly. This panic in remove_synthetic_mount_target fires when the lstat errors with anything other than NotFound — so the target exists but its metadata cannot be read (EACCES, EIO, ESTALE on a dead NFS mount), preventing the code from deciding whether the target should be removed.

Solutions

  1. Check the io::Error errno in the message
  2. Verify permissions on the synthetic mount target path
  3. Investigate stale network mounts (ESTALE) or filesystem corruption
  4. Manually remove the synthetic target while no sandbox is running
Defensive patterns

Strategy: try-catch

When it happens

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

Appendix: source

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

    let directory = OpenOptions::new()
        .read(true)
        .custom_flags(libc::O_PATH | libc::O_DIRECTORY | libc::O_NOFOLLOW)
        .open(path)?;
    let directory_path = PathBuf::from(format!("/proc/self/fd/{}", directory.as_raw_fd()));
    fs::set_permissions(&directory_path, fs::Permissions::from_mode(0o700))?;
    for entry in fs::read_dir(directory_path)? {
        make_directory_tree_writable(&entry?.path())?;
    }
    Ok(())
}

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(()) => {}

View on GitHub (pinned to 339751715c)