Hmbown/CodeWhale · error · anyhow::Error

Tool was called with a network address, but this agent runs…

Error message

Tool {name} was called with a network address, but this agent runs with no network capability (`network_tool = false`). Local sources are still available; a remote one needs a member whose saved ceiling grants network tools.

What it means

Sub-agents run under a capability model: when `network_tool = false`, the guard rejects any tool invocation that carries a network address. Only tools whose input matches a GitHub read-only shell command or carries no network URL pass. The error directs the caller to a role whose saved ceiling grants network tools.

Solutions

  1. Use a role/member whose saved capability ceiling grants network tools
  2. Switch the source to a local one (local file/path) instead of a network address
  3. Restructure the command to a GitHub read-only command form if that suffices

Example fix

// before
spawn_subagent(role: "verifier", network_tool: false)
subagent.call("exec", { command: "curl https://example.com/data.json" })
// after
spawn_subagent(role: "researcher", network_tool: true)
subagent.call("exec", { command: "curl https://example.com/data.json" })
Defensive patterns

Strategy: validation

Validate before calling

if (!agent.networkTool && /https?:\/\//.test(JSON.stringify(input))) {
  throw new Error('network tool required for remote URL');
}

Type guard

const carriesNetworkUrl = (input) => JSON.stringify(input).match(/https?:\/\/[^\s"']+/) !== null;

Prevention

When it happens

Trigger: Calling a tool (e.g. fetch/exec-family) from a sub-agent with `network_tool = false` while the input contains a network URL, or a shell command that is not on the GitHub read-only allowlist (`codewhale_execpolicy::command_safety::is_github_readonly_command`).

Common situations: Spawning a researcher sub-agent without network capability and asking it to fetch a remote URL; asking a read-only agent to `git clone` from a remote; a prompt instructs the agent to download something while the saved ceiling disallows network.

Understand the failure class

Background: Permission denied / not authorized / 403 Forbidden: access-control rejections when the caller lacks the required role, grant, or ownership — this error's family across 18 libraries.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22). Data as JSON: /api/errors/14dcf6341abe89f0. Report an issue: GitHub.

Appendix: source

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

/// - `rlm{action:"open", url:...}` calls `FetchUrlTool::execute` directly.
/// - `review{target:"https://github.com/o/r/pull/1"}` shells out to `gh pr
///   diff`, which is the network by way of a subprocess.
///
/// Both are now unreachable by name as well (`rlm_open` is denied outright;
/// `review`'s local forms are the ones worth keeping), so this is the layer that
/// catches the *next* one — a tool that grows a `url` field after this list was
/// written. It fails closed and names the posture, so the refusal reads as a
/// contract rather than a malfunction.
fn reject_network_reaching_input(name: &str, input: &Value) -> Result<()> {
    let github_shell_read = matches!(name, "bash" | "Bash" | "exec_shell")
        && input
            .get("command")
            .and_then(Value::as_str)
            .is_some_and(codewhale_execpolicy::command_safety::is_github_readonly_command);
    if !github_shell_read && !carries_network_url(input) {
        return Ok(());
    }
    Err(anyhow!(
        "Tool {name} was called with a network address, but this agent runs with no network \
         capability (`network_tool = false`). Local sources are still available; a remote one \
         needs a member whose saved ceiling grants network tools."
    ))
}

/// Refuse the unbounded forms of the verification surface for a write-denied
/// child.
///
/// A read-only member keeps `Run` / `run_tests` / `run_verifiers` on purpose:
/// running the checks is what a verifier is *for*, and removing them would make
/// the role useless. But both tools accept an escape hatch that is not
/// verification at all — `run_verifiers` takes `commands`, an array of arbitrary
/// `program` + `args` pairs, and `run_tests` takes `args`, a raw cargo argv.
/// `{"program": "bash", "args": ["-lc", "rm -rf src"]}` is exactly the raw shell
/// that [`crate::fleet::role::RAW_SHELL_DENYLIST`] just removed, re-entered
/// through the one door that was left open for honest reasons.
///

View on GitHub (pinned to 73e0f67d83)