zed-industries/zed · error

Failed to send Windows-drive sandbox warning: {error}

Error message

Failed to send Windows-drive sandbox warning: {error}

What it means

On Windows, writes targeting a drive outside the sandbox's project drive get a dedicated warning prompt; if sending that ThreadEvent fails, the event-stream receiver is gone and this error wraps the send failure. The write cannot be authorized without a live consumer, so it fails.

Source

Thrown at crates/agent/src/thread.rs:5990

                .unbounded_send(Ok(ThreadEvent::ToolCallAuthorization(
                    ToolCallAuthorization {
                        tool_call: acp::ToolCallUpdate::new(
                            tool_call_id,
                            // Leave the title untouched so the card keeps
                            // showing the command (matching the escalation
                            // flow).
                            acp::ToolCallUpdateFields::new(),
                        )
                        .meta(acp_thread::meta_with_sandbox_authorization(details)),
                        options,
                        response: response_tx,
                        context: None,
                        kind: acp_thread::AuthorizationKind::PermissionGrant,
                    },
                )))
            {
                log::error!("Failed to send Windows-drive sandbox warning: {error}");
                return Err(anyhow!(
                    "Failed to send Windows-drive sandbox warning: {error}"
                ));
            }

            let outcome = response_rx
                .await
                .map_err(|_| anyhow!("authorization channel closed"))?;
            ensure_tool_call_authorization_not_interrupted(&outcome)?;
            match acp_thread::SandboxPermission::from_id(outcome.option_id.0.as_ref()) {
                Some(acp_thread::SandboxPermission::AllowOnce) => Ok(()),
                _ => Err(anyhow!("Windows-drive write aborted by user")),
            }
        })
    }

    fn sandbox_request_covered_by_grants(
        request: &SandboxRequest,
        sandbox_grants: &Rc<RefCell<ThreadSandboxGrants>>,

View on GitHub (pinned to bc538def45)

Solutions

  1. Keep the ThreadEvent receiver alive for the thread's whole lifetime
  2. Handle the error as cancellation and roll back the pending write
  3. Restrict sandboxed writes to the project drive to avoid the cross-drive prompt entirely
  4. Cancel the thread before closing the UI so pending warnings resolve as cancelled turns
Defensive patterns

Strategy: try-catch

Try / catch

if let Err(err) = windows_drive_warning_result {
    if err.to_string().starts_with("Failed to send Windows-drive sandbox warning") {
        // Event consumer is gone: treat as cancellation and roll back the write.
        abort_pending_write();
        return Ok(());
    }
    return Err(err);
}

Prevention

When it happens

Trigger: A sandboxed tool attempts a write to another Windows drive while the thread's event receiver has been dropped (UI closed or client disconnected), so the warning event cannot be delivered.

Common situations: Windows users writing to absolute paths on other drives with the agent panel closed mid-turn; client reloads during cross-drive operations.

Related errors


AI-assisted analysis of zed-industries/zed@bc538def45 (2026-08-16). Data as JSON: /api/errors/b4cdc507f93b759a. Report an issue: GitHub.