{"record":{"id":"8e168fd03ce88af2","repo":"zed-industries/zed","slug":"reason","errorCode":null,"errorMessage":"{reason}","messagePattern":"\\{reason\\}","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"warning","filePath":"crates/agent/src/thread.rs","lineNumber":6502,"sourceCode":"                        // status with an internal selected outcome. Dropping\n                        // `response_rx` prevents the synthetic response from\n                        // being delivered back into this loop.\n                        match cx.update(|cx| check_settings(cx)) {\n                            ToolPermissionDecision::Allow => {\n                                drop(response_rx);\n                                stream.resolve_tool_call_authorization(\n                                    &tool_call_id,\n                                    auto_allow_outcome.clone(),\n                                );\n                                return Ok(());\n                            }\n                            ToolPermissionDecision::Deny(reason) => {\n                                drop(response_rx);\n                                stream.resolve_tool_call_authorization(\n                                    &tool_call_id,\n                                    auto_deny_outcome.clone(),\n                                );\n                                return Err(anyhow!(reason));\n                            }\n                            ToolPermissionDecision::Confirm => continue,\n                        }\n                    }\n                }\n            }\n        })\n    }\n\n    /// Interprets a `SelectedPermissionOutcome` and persists any settings changes.\n    /// Returns `true` if the tool call should be allowed, `false` if denied.\n    fn persist_permission_outcome(\n        outcome: &acp_thread::SelectedPermissionOutcome,\n        fs: Option<Arc<dyn Fs>>,\n        cx: &AsyncApp,\n    ) -> Result<()> {\n        let option_id = outcome.option_id.0.as_ref();\n        let err = || Err(anyhow!(\"Permission to run tool denied by user\"));","sourceCodeStart":6484,"sourceCodeEnd":6520,"githubUrl":"https://github.com/zed-industries/zed/blob/bc538def4545534201bbfcac4e95ac34ea6501b6/crates/agent/src/thread.rs#L6484-L6520","documentation":"The tool call was denied automatically by permission rules rather than by a human: during the settings race, `check_settings` returned `ToolPermissionDecision::Deny(reason)`. The agent resolves the tool call with the deny outcome and fails it with the rule's own reason string, so the message content comes from settings evaluation, not this code.","triggerScenarios":"A deny rule matches the tool call — the user previously chose 'always deny' for this tool or command pattern, or a ruleset in settings denies it — and the evaluation fires either at prompt time or after a settings change re-triggers the check.","commonSituations":"An earlier 'Always deny' selection matching a broader pattern than intended; organization-wide settings with deny rules; the model retrying a tool that rules now block.","solutions":["Read the reason string — it identifies the rule that denied the call; adjust or remove that rule in settings if the call is legitimate.","Narrow overly-broad deny patterns or switch the tool back to 'ask' mode.","Do not retry the identical call; change the approach or ask the user to update permissions."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"match run_tool().await {\n    Err(err) if err.to_string() == deny_reason_from_settings => {\n        // Rule-driven denial: show the reason, do not retry the same call.\n        report_denied_to_user(err.to_string());\n        Ok(Default::default())\n    }\n    result => result,\n}","preventionTips":["Keep deny rules narrow; prefer 'ask' over broad 'deny' patterns.","Read the reason string before editing settings — it identifies the matching rule.","Never auto-retry a settings-denied call; change approach or permissions."],"tags":["agent","permissions","settings","deny-rules"],"backgroundTag":null,"analyzedSha":"bc538def4545534201bbfcac4e95ac34ea6501b6","analyzedAt":"2026-08-16T07:30:46.435Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}