zed-industries/zed · error

authorization channel closed

Error message

authorization channel closed

What it means

After sending a sandbox authorization request, the task awaits the user's answer on a oneshot channel; if that channel closes, 'authorization channel closed' is returned. The responder was dropped (prompt dismissed, client disconnected) without answering, so the permission outcome can never arrive.

Source

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

                return Err(anyhow!("Failed to send sandbox authorization: {error}"));
            }

            let (mut settings_tx, mut settings_rx) = watch::channel(());
            let _settings_subscription = cx.update(|cx| {
                cx.observe_global::<SettingsStore>(move |_cx| {
                    settings_tx.send(()).ok();
                })
            });

            loop {
                let settings_changed = async {
                    if settings_rx.changed().await.is_err() {
                        std::future::pending::<()>().await;
                    }
                };
                futures::select_biased! {
                    outcome = (&mut response_rx).fuse() => {
                        let outcome = outcome.map_err(|_| anyhow!("authorization channel closed"))?;
                        ensure_tool_call_authorization_not_interrupted(&outcome)?;
                        return Self::handle_sandbox_permission_outcome(
                            &outcome,
                            &request,
                            sandbox_grants.clone(),
                            thread.clone(),
                            fs.clone(),
                            cx,
                        );
                    }
                    _ = settings_changed.fuse() => {
                        if cx.update(|cx| Self::sandbox_request_covered_by_grants(
                            &request,
                            &sandbox_grants,
                            cx,
                        )) {
                            drop(response_rx);
                            stream.resolve_tool_call_authorization(

View on GitHub (pinned to bc538def45)

Solutions

  1. Treat this error as a denial or cancellation and stop the tool call; do not retry the authorization
  2. Ensure the UI always responds to ToolCallAuthorization events, including on dismissal
  3. Keep the client session alive while any authorization request is pending
  4. Cancel the thread before disconnecting so pending prompts resolve deterministically
Defensive patterns

Strategy: try-catch

Try / catch

match permission_outcome {
    Ok(decision) => apply(decision),
    Err(err) if err.to_string() == "authorization channel closed" => {
        // Prompt dismissed / client gone: behave like a denial.
        abort_tool_call("authorization dismissed");
    }
    Err(err) => return Err(err),
}

Prevention

When it happens

Trigger: The authorization prompt is dismissed (UI closed, session ended, client dropped the request) while the thread waits on response_rx; any path where the response sender is dropped without sending an outcome.

Common situations: User closes the agent panel instead of answering; a client reload during a permission prompt; UI code that drops authorization requests on teardown instead of responding with a denial.

Related errors


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