{"record":{"id":"b4cdc507f93b759a","repo":"zed-industries/zed","slug":"failed-to-send-windows-drive-sandbox-warning-err","errorCode":null,"errorMessage":"Failed to send Windows-drive sandbox warning: {error}","messagePattern":"Failed to send Windows-drive sandbox warning: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/agent/src/thread.rs","lineNumber":5990,"sourceCode":"                .unbounded_send(Ok(ThreadEvent::ToolCallAuthorization(\n                    ToolCallAuthorization {\n                        tool_call: acp::ToolCallUpdate::new(\n                            tool_call_id,\n                            // Leave the title untouched so the card keeps\n                            // showing the command (matching the escalation\n                            // flow).\n                            acp::ToolCallUpdateFields::new(),\n                        )\n                        .meta(acp_thread::meta_with_sandbox_authorization(details)),\n                        options,\n                        response: response_tx,\n                        context: None,\n                        kind: acp_thread::AuthorizationKind::PermissionGrant,\n                    },\n                )))\n            {\n                log::error!(\"Failed to send Windows-drive sandbox warning: {error}\");\n                return Err(anyhow!(\n                    \"Failed to send Windows-drive sandbox warning: {error}\"\n                ));\n            }\n\n            let outcome = response_rx\n                .await\n                .map_err(|_| anyhow!(\"authorization channel closed\"))?;\n            ensure_tool_call_authorization_not_interrupted(&outcome)?;\n            match acp_thread::SandboxPermission::from_id(outcome.option_id.0.as_ref()) {\n                Some(acp_thread::SandboxPermission::AllowOnce) => Ok(()),\n                _ => Err(anyhow!(\"Windows-drive write aborted by user\")),\n            }\n        })\n    }\n\n    fn sandbox_request_covered_by_grants(\n        request: &SandboxRequest,\n        sandbox_grants: &Rc<RefCell<ThreadSandboxGrants>>,","sourceCodeStart":5972,"sourceCodeEnd":6008,"githubUrl":"https://github.com/zed-industries/zed/blob/bc538def4545534201bbfcac4e95ac34ea6501b6/crates/agent/src/thread.rs#L5972-L6008","documentation":"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.","triggerScenarios":"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.","commonSituations":"Windows users writing to absolute paths on other drives with the agent panel closed mid-turn; client reloads during cross-drive operations.","solutions":["Keep the ThreadEvent receiver alive for the thread's whole lifetime","Handle the error as cancellation and roll back the pending write","Restrict sandboxed writes to the project drive to avoid the cross-drive prompt entirely","Cancel the thread before closing the UI so pending warnings resolve as cancelled turns"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if let Err(err) = windows_drive_warning_result {\n    if err.to_string().starts_with(\"Failed to send Windows-drive sandbox warning\") {\n        // Event consumer is gone: treat as cancellation and roll back the write.\n        abort_pending_write();\n        return Ok(());\n    }\n    return Err(err);\n}","preventionTips":["Keep the ThreadEvent receiver alive for the thread's whole lifetime","Cancel the thread before closing the UI so pending warnings resolve as cancelled turns","Restrict sandboxed writes to the project drive to avoid cross-drive prompts entirely","Answer or explicitly deny pending prompts during teardown"],"tags":["rust","agent","windows","sandbox","authorization","channel","lifecycle"],"backgroundTag":null,"analyzedSha":"bc538def4545534201bbfcac4e95ac34ea6501b6","analyzedAt":"2026-08-16T07:30:46.435Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}