Hmbown/CodeWhale · error

Fleet tool authority cannot be combined with exec --resume…

Error message

Fleet tool authority cannot be combined with exec --resume, --session-id, or --continue

What it means

The exec subcommand's tool-authority option (a JSON spec restricting which tools the run may use) is only meaningful for a fresh run. When combined with resume-style flags (--resume, --session-id, --continue), validate_exec_tool_authority_resume rejects it, since a resumed session already has its recorded tool authority and applying a new one would conflict.

Solutions

  1. Drop the --tool-authority flag when resuming; the session restores its own authority
  2. Start a fresh exec run (no --resume/--session-id/--continue) if you need a new tool-authority spec
  3. Split the operation: resume without authority changes, then launch a new run with the new authority

Example fix

# before
codewhale exec --resume abc123 --tool-authority '{"exec":"deny"}' -p "continue"
# after
codewhale exec --resume abc123 -p "continue"
Defensive patterns

Strategy: validation

Validate before calling

if (args.toolAuthority && (args.resume || args.sessionId || args.continue)) {
  throw new Error("--tool-authority is only valid for fresh exec runs");
}

Try / catch

try {
  runExec(args);
} catch (e) {
  if (String(e).includes("cannot be combined with exec")) {
    // strip --tool-authority and retry the resume without it, or surface choice to user
  }
}

Prevention

When it happens

Trigger: Running e.g. `codewhale exec --resume <id> --tool-authority '{...}'`, or `--session-id` / `--continue` together with the tool-authority JSON flag in a single CLI invocation.

Common situations: Scripted re-runs that blindly pass all stored flags including tool authority while also resuming; users wanting to tighten permissions on a session mid-flight; copied command lines from docs mixing both options.

Understand the failure class

Background: "mutually exclusive" flag errors: what "can't supply both nx and xx", "--raw is not compatible with -i" and "cannot be used with" mean, and how to fix them — this error's family across 29 libraries.

Related errors


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

Appendix: source

Thrown at crates/tui/src/lib.rs:12980

    model: String,
    prompt: String,
    output: String,
    tools: Vec<ExecToolEntry>,
    outcomes: Vec<ExecOutcome>,
    status: Option<String>,
    termination_reason: Option<String>,
    error_category: Option<String>,
    error: Option<String>,
    #[serde(skip_serializing_if = "Vec::is_empty")]
    released_services: Vec<crate::tools::shell::PersistentServiceReceipt>,
}

fn validate_exec_tool_authority_resume(
    tool_authority_json: Option<&str>,
    resuming: bool,
) -> Result<()> {
    if tool_authority_json.is_some() && resuming {
        bail!(
            "Fleet tool authority cannot be combined with exec --resume, --session-id, or --continue"
        );
    }
    Ok(())
}

fn exec_network_policy(
    config: &Config,
    outer_network_access: Option<bool>,
) -> Option<crate::network_policy::NetworkPolicyDecider> {
    // Fleet caps are an outer authority boundary: user configuration may
    // narrow them further, but it may never widen an explicit network denial.
    if outer_network_access == Some(false) {
        return Some(crate::network_policy::NetworkPolicyDecider::new(
            crate::network_policy::NetworkPolicy {
                default: crate::network_policy::DecisionToml::Deny,
                ..crate::network_policy::NetworkPolicy::default()
            },

View on GitHub (pinned to 73e0f67d83)