openai/codex · error

failed to open synthetic bubblewrap mount registry lock

Error message

failed to open synthetic bubblewrap mount registry lock {}: {err}

What it means

Opening the lock file for the synthetic mount registry failed. This panic in with_synthetic_mount_registry_lock fires when OpenOptions::open on registry_root/lock errors — permissions problems or filesystem failures on the temp dir — so mutual exclusion between concurrent sandbox cleanups cannot be established and the operation aborts.

Solutions

  1. Check permissions on the registry lock file and its directory for the current uid
  2. Remove a stale lock file with wrong ownership while no sandbox is running
  3. Verify the temp filesystem is writable and healthy
  4. Point TMPDIR at a writable location
Defensive patterns

Strategy: validation

When it happens

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

Appendix: source

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

}

fn with_synthetic_mount_registry_lock<T>(f: impl FnOnce() -> T) -> T {
    let registry_root = synthetic_mount_registry_root();
    fs::create_dir_all(&registry_root).unwrap_or_else(|err| {
        panic!(
            "failed to create synthetic bubblewrap mount registry {}: {err}",
            registry_root.display()
        )
    });
    let lock_path = registry_root.join("lock");
    let lock_file = OpenOptions::new()
        .read(true)
        .write(true)
        .create(true)
        .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()
        );

View on GitHub (pinned to 339751715c)