Hmbown/CodeWhale · error · anyhow::Error

Custom sub-agent requires a non-empty allowed_tools list

Error message

Custom sub-agent requires a non-empty allowed_tools list

What it means

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.

Source

Thrown at crates/tui/src/tools/subagent/mod.rs:15208

///
/// `allow_shell = false` no longer narrows the tool LIST — the child's
/// registry simply doesn't register shell tools, which has the same
/// effect without papering over the parent's choice with a deny-list.
fn build_allowed_tools(
    agent_type: &FleetRole,
    explicit_tools: Option<Vec<String>>,
    _allow_shell: bool,
) -> Result<Option<Vec<String>>> {
    if let Some(tools) = explicit_tools {
        let mut deduped = Vec::new();
        for tool in tools {
            let name = tool.trim();
            if !name.is_empty() && !deduped.iter().any(|existing: &String| existing == name) {
                deduped.push(name.to_string());
            }
        }
        if matches!(agent_type, FleetRole::Custom) && deduped.is_empty() {
            return Err(anyhow!(
                "Custom sub-agent requires a non-empty allowed_tools list"
            ));
        }
        return Ok(Some(deduped));
    }

    if matches!(agent_type, FleetRole::Custom) {
        return Err(anyhow!(
            "Custom sub-agent requires a non-empty allowed_tools list"
        ));
    }

    // Default: full registry inheritance from the parent. The child sees every
    // tool the parent has, including the sub-agent management family. The
    // registry execution guard still blocks approval-gated tools unless the
    // parent runtime is auto-approved.
    Ok(None)
}

View on GitHub (pinned to 0c42157ee5)

Solutions

  1. Add at least one tool name to the allowed_tools list of the custom sub-agent definition.
  2. Remove the allowed_tools field entirely so the agent inherits the default tool set instead of an empty explicit one.
  3. Trim whitespace-only entries and confirm the remaining names match real, registered tool identifiers.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/tui/src/tools/subagent/mod.rs:15208 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Hmbown/CodeWhale@0c42157ee5 (2026-08-20). Data as JSON: /api/errors/0f21d828f0cd724c. Report an issue: GitHub.