{"record":{"id":"0aa07dbe01b1e235","repo":"Hmbown/CodeWhale","slug":"tool-name-not-allowed-for-this-sub-agent","errorCode":null,"errorMessage":"Tool {name} not allowed for this sub-agent","messagePattern":"Tool (.+?) not allowed for this sub-agent","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/tui/src/tools/subagent/mod.rs","lineNumber":14768,"sourceCode":"        {\n            return Err(anyhow!(\n                \"Tool Web is limited to search/fetch in the read-only evidence profile\"\n            ));\n        }\n        let family_action_allowed = if !Self::ACTION_ALIASES\n            .iter()\n            .any(|(family, _, _)| *family == name)\n        {\n            true\n        } else if let Some(action) = action {\n            self.is_action_allowed(name, action)\n        } else {\n            self.allowed_tools\n                .as_ref()\n                .is_none_or(|list| list.iter().any(|allowed| allowed == name))\n        };\n        if !self.is_tool_allowed(name) || !family_action_allowed {\n            return Err(anyhow!(\"Tool {name} not allowed for this sub-agent\"));\n        }\n        // #3217: authoritative per-role posture — read-only roles cannot mutate\n        // and non-`Full`-shell roles cannot run shell, regardless of whether\n        // the parent session is auto-approved. This closes the auto-approve\n        // bypass where a read-only child could quietly write or shell out.\n        if !self.posture_permits_tool(name, Some(&input)) {\n            return Err(anyhow!(\n                \"Tool {name} is not permitted for the read-only Fleet role `{role}`. Use a `builder` or `worker` role (or `custom` with an explicit allowed_tools list) to mutate the workspace or run shell commands.\",\n                role = self.agent_type.as_str()\n            ));\n        }\n        // The session's permission posture, applied to this child exactly as\n        // it is applied to the parent turn: the deterministic Auto-Review\n        // floor first, then (Auto-Review) the model guardian for holds it\n        // could not prove safe, or (Ask) a prompt raised in the parent's UI.\n        // Full Access still fails closed on the non-bypassable safety floor.\n        // Role posture and the execution envelope below stay authoritative:\n        // this gate can only decide whether a call the role permits also","sourceCodeStart":14750,"sourceCodeEnd":14786,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/0c42157ee52f9d55af2b506d71b46249910f77d3/crates/tui/src/tools/subagent/mod.rs#L14750-L14786","documentation":"Permission guard in the sub-agent tool executor: is_tool_allowed(name) or the per-action family check (is_action_allowed) returned false — the tool (or the specific action on an aliased family tool) is not in this agent's allowed_tools list or policy-filtered catalog. The request is refused before hydration or execution.","triggerScenarios":"Thrown at crates/tui/src/tools/subagent/mod.rs:14768 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Add the tool to the agent's allowed_tools list when spawning","Use a role/agent type whose catalog includes the tool","For family tools, check whether the specific action is permitted for this agent"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0c42157ee52f9d55af2b506d71b46249910f77d3","analyzedAt":"2026-08-20T21:50:45.477Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}