zed-industries/zed · error · anyhow::Error

cannot capture writable sandbox path

Error message

cannot capture writable sandbox path `{}`

What it means

to_policy failed because a writable sandbox path could not be captured as a HostFilesystemLocation (typically it no longer exists or is invalid), so the sandbox policy cannot be constructed for the terminal command.

Solutions

  1. A protected path could not be captured as a sandbox HostFilesystemLocation (e.g. it doesn't exist or isn't representable); correct or remove the protected path entry
  2. Verify the path exists and is absolute; protected paths that can't be captured normally fail the whole policy construction
  3. Update sandbox configuration so protected paths point at real directories
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/acp_thread/src/terminal.rs:279 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20). Data as JSON: /api/errors/2b4043b02de1ca62. Report an issue: GitHub.

Appendix: source

Thrown at crates/acp_thread/src/terminal.rs:279

    /// synthesized `settings.json/.git` routes through a file — without closing
    /// the hole. So we drop and move on.
    fn to_policy(&self) -> Result<sandbox::SandboxPolicy> {
        let protected_paths = self
            .protected_paths
            .iter()
            .filter_map(|path| sandbox::HostFilesystemLocation::capture(path).ok())
            .collect::<Vec<_>>();
        let fs = if self.allow_fs_write {
            sandbox::SandboxFsPolicy::Unrestricted { protected_paths }
        } else {
            // Project worktree paths are captured fresh; user-approved grants are
            // rebuilt via the verifying reopen (or captured when legacy bare
            // strings) through `granted_write_path_to_location`. A path that
            // can't be captured fails the whole construction (never created).
            let mut locations = Vec::new();
            for path in &self.writable_paths {
                let location = sandbox::HostFilesystemLocation::capture(path).map_err(|error| {
                    anyhow::anyhow!(error).context(format!(
                        "cannot capture writable sandbox path `{}`",
                        path.display()
                    ))
                })?;
                locations.push(location);
            }
            for granted in &self.extra_write_paths {
                let location = granted_write_path_to_location(granted).map_err(|error| {
                    anyhow::anyhow!(error).context(format!(
                        "cannot re-verify approved sandbox write grant `{}` (if the \
                         directory was removed, remove the grant or recreate the \
                         directory)",
                        granted.requested.display()
                    ))
                })?;
                locations.push(location);
            }
            // Dedupe to a minimal cover on the captured canonical paths, so a

View on GitHub (pinned to f4178619ac)