{"record":{"id":"597cad70083d9720","repo":"zed-industries/zed","slug":"bwrap-is-present-but-failed-to-create-a-sandbox","errorCode":null,"errorMessage":"`bwrap` is present but failed to create a sandbox (unprivileged user namespaces may be disabled)","messagePattern":"`bwrap` is present but failed to create a sandbox \\(unprivileged user namespaces may be disabled\\)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/sandbox/src/linux_bubblewrap.rs","lineNumber":633,"sourceCode":"    // inodes were pinned at policy-construction time, so a missing path here\n    // means the location vanished since capture. Never create it with the\n    // agent's ambient permissions — recreating from path text would bind a\n    // fresh, unapproved object in place of the pinned one (and historically\n    // this materialized bogus paths, e.g. a granted *file* path springing into\n    // existence as a directory). Running anyway would give the command silently\n    // less access than it believes it has — so fail closed with a clear error.\n    if !permissions.allow_fs_write {\n        for directory in writable_dirs {\n            if !directory.exists() {\n                bail!(\n                    \"failed to provide writable sandbox path {}: it no longer exists\",\n                    directory.display()\n                );\n            }\n        }\n    }\n\n    let bwrap = resolve_bwrap().map_err(|status| anyhow!(status.describe()))?;\n    let proxy_socket_sandbox_path = match permissions.network {\n        NetworkAccess::LocalhostPort(_) => Some(unique_proxy_socket_sandbox_path()),\n        NetworkAccess::None | NetworkAccess::All => None,\n    };\n    let mut bwrap_args = build_bwrap_args_with_sandbox_paths(\n        writable_dirs,\n        protected_paths,\n        permissions,\n        cwd,\n        proxy_socket_path,\n        proxy_socket_sandbox_path.as_deref(),\n        validation_socket.map(|socket| socket.host_socket_path),\n        validation_socket.map(|socket| socket.sandbox_socket_path),\n    );\n    bwrap_args.push(\"--\".to_string());\n\n    let bridge = match permissions.network {\n        NetworkAccess::LocalhostPort(port) => {","sourceCodeStart":615,"sourceCodeEnd":651,"githubUrl":"https://github.com/zed-industries/zed/blob/5a9b9558db01a6b906cec2fb70a797affdc58cdd/crates/sandbox/src/linux_bubblewrap.rs#L615-L651","documentation":"bubblewrap is installed but failed to create a sandbox, most likely because unprivileged user namespaces are disabled (via sysctl or seccomp), so the invocation is refused rather than run unsandboxed.","triggerScenarios":"Thrown at crates/sandbox/src/linux_bubblewrap.rs:633 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Enable unprivileged user namespaces (kernel.unprivileged_userns_clone=1)","Update bubblewrap to a working version","Run outside the sandbox only if acceptable"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5a9b9558db01a6b906cec2fb70a797affdc58cdd","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}