{"record":{"id":"0f21d828f0cd724c","repo":"Hmbown/CodeWhale","slug":"custom-sub-agent-requires-a-non-empty-allowed-tool","errorCode":null,"errorMessage":"Custom sub-agent requires a non-empty allowed_tools list","messagePattern":"Custom sub-agent requires a non-empty allowed_tools list","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/tui/src/tools/subagent/mod.rs","lineNumber":15208,"sourceCode":"///\n/// `allow_shell = false` no longer narrows the tool LIST — the child's\n/// registry simply doesn't register shell tools, which has the same\n/// effect without papering over the parent's choice with a deny-list.\nfn build_allowed_tools(\n    agent_type: &FleetRole,\n    explicit_tools: Option<Vec<String>>,\n    _allow_shell: bool,\n) -> Result<Option<Vec<String>>> {\n    if let Some(tools) = explicit_tools {\n        let mut deduped = Vec::new();\n        for tool in tools {\n            let name = tool.trim();\n            if !name.is_empty() && !deduped.iter().any(|existing: &String| existing == name) {\n                deduped.push(name.to_string());\n            }\n        }\n        if matches!(agent_type, FleetRole::Custom) && deduped.is_empty() {\n            return Err(anyhow!(\n                \"Custom sub-agent requires a non-empty allowed_tools list\"\n            ));\n        }\n        return Ok(Some(deduped));\n    }\n\n    if matches!(agent_type, FleetRole::Custom) {\n        return Err(anyhow!(\n            \"Custom sub-agent requires a non-empty allowed_tools list\"\n        ));\n    }\n\n    // Default: full registry inheritance from the parent. The child sees every\n    // tool the parent has, including the sub-agent management family. The\n    // registry execution guard still blocks approval-gated tools unless the\n    // parent runtime is auto-approved.\n    Ok(None)\n}","sourceCodeStart":15190,"sourceCodeEnd":15226,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/0c42157ee52f9d55af2b506d71b46249910f77d3/crates/tui/src/tools/subagent/mod.rs#L15190-L15226","documentation":"Validation guard in build_allowed_tools: when a custom sub-agent definition supplies an explicit allowed_tools list, the list was empty (or contained only blank entries) after trimming. build_allowed_tools treats an explicit-but-empty tool list as a configuration mistake, because a sub-agent with no permitted tools could never act.","triggerScenarios":"Thrown at crates/tui/src/tools/subagent/mod.rs:15208 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Add at least one tool name to the allowed_tools list of the custom sub-agent definition.","Remove the allowed_tools field entirely so the agent inherits the default tool set instead of an empty explicit one.","Trim whitespace-only entries and confirm the remaining names match real, registered tool identifiers."],"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-14T05:17:10.506Z"}