{"record":{"id":"9e472b73f8e6f204","repo":"Hmbown/CodeWhale","slug":"tool-name-is-not-active-for-this-sub-agent","errorCode":null,"errorMessage":"Tool {name} is not active for this sub-agent","messagePattern":"Tool (.+?) is not active for this sub-agent","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/tui/src/tools/subagent/mod.rs","lineNumber":18139,"sourceCode":"        }\n\n        let Some(deferred) = surface\n            .catalog\n            .iter()\n            .find(|tool| tool.name == name)\n            .map(|tool| tool.defer_loading.unwrap_or(false))\n        else {\n            return Err(anyhow!(\n                \"Tool {name} is not in this child's policy-filtered catalog\"\n            ));\n        };\n        if deferred && !request_active_names.contains(name) {\n            return surface\n                .hydrate(name)\n                .map(|content| RichToolResult::plain(ToolResult::success(content)));\n        }\n        if !request_active_names.contains(name) {\n            return Err(anyhow!(\"Tool {name} is not active for this sub-agent\"));\n        }\n        let result = self.execute_full(agent_id, tool_id, name, input).await;\n        if deferred && result.is_ok() {\n            touch_cached_tool_after_execution(\n                &surface.catalog,\n                &mut surface.active_names,\n                &mut surface.cache,\n                name,\n            );\n        }\n        result\n    }\n}\n\n/// A child admission refusal is a typed permission denial, not an opaque\n/// execution error — the worker loop's no-progress guard (#6015) can only\n/// count denials it can name.\n/// Whether `name` is a desktop / computer-control surface.","sourceCodeStart":18121,"sourceCodeEnd":18157,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/tools/subagent/mod.rs#L18121-L18157","documentation":"The sub-agent tool dispatcher checks every requested tool name against `request_active_names`, the set of tools activated for this specific sub-agent request. Deferred tools may be hydrated lazily, but once hydration is not applicable, calling a tool that is not in the active set is rejected. This enforces the tool allowlist the parent configured for the sub-agent.","triggerScenarios":"A sub-agent (or the model driving it) invokes a tool whose name is not in the allowed/active tool list for that sub-agent request, and the tool is not a deferred tool eligible for hydration (`deferred` false, or deferred but already consumed).","commonSituations":"Parent passes an `allowed_tools` list that omits a tool the sub-agent's prompt tells it to use; a custom role's tool list is stale after a rename; deferred tool hydration was already returned once so the second call falls through to the active-name check.","solutions":["Add the tool name to the sub-agent's allowed_tools list in the parent configuration","Pick a different tool that is active for this sub-agent","If the tool should be deferred, request it through the hydration path once instead of executing directly"],"exampleFix":"// before\nspawn_subagent(role: \"researcher\", allowed_tools: [\"web_search\"])\nsubagent.call(\"fetch_url\", ...)\n// after\nspawn_subagent(role: \"researcher\", allowed_tools: [\"web_search\", \"fetch_url\"])","handlingStrategy":"validation","validationCode":"const active = new Set(requestActiveNames);\nif (!active.has(toolName)) throw new Error(`Tool ${toolName} not active for sub-agent`);\nawait subagent.call(toolName, input);","typeGuard":"const isActiveTool = (name, activeNames) => activeNames.includes(name);","tryCatchPattern":null,"preventionTips":["Keep the sub-agent's prompt tool list in sync with allowed_tools","Validate tool names against the request's active set before dispatch","Log denied tool calls to catch stale allowlists"],"tags":["subagent","tool-permissions","allowlist"],"backgroundTag":"permission-denied","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}