Hmbown/CodeWhale · error · anyhow::Error
Sub-agents run in the background and cannot use Bash with in
Error message
Sub-agents run in the background and cannot use Bash with interactive=true because that would take over the parent TUI terminal. Use Bash without interactive, or with background=true / tty=true, or task_shell_start instead.
What it means
Error "Sub-agents run in the background and cannot use Bash with interactive=true because that would take over the parent TUI terminal. Use Bash without interactive, or with background=true / tty=true, or task_shell_start instead." thrown in Hmbown/CodeWhale.
Source
Thrown at crates/tui/src/tools/subagent/mod.rs:15172
};
raw_paths
.into_iter()
.map(|path| normalize_claim_path(&path).map_err(anyhow::Error::msg))
.collect()
}
fn reject_subagent_terminal_takeover(name: &str, input: &Value) -> Result<()> {
let wants_interactive_shell = matches!(name, "bash" | "Bash" | "exec_shell")
&& input
.get("action")
.and_then(Value::as_str)
.is_none_or(|action| action == "run")
&& input
.get("interactive")
.and_then(Value::as_bool)
.unwrap_or(false);
if wants_interactive_shell {
return Err(anyhow!(
"Sub-agents run in the background and cannot use Bash with interactive=true \
because that would take over the parent TUI terminal. Use Bash without \
interactive, or with background=true / tty=true, or task_shell_start \
instead."
));
}
Ok(())
}
/// Resolve the effective allowed-tools list for a child.
///
/// **v0.6.6 default: full inheritance.** Returning `Ok(None)` means the
/// child sees the same tool surface as the parent's Agent mode — every
/// family including `with_subagent_tools` so it can recurse. The narrowing
/// path (`Ok(Some(list))`) is only used by:
/// - `Custom` agent types (which require an explicit list).
/// - Callers that pass `explicit_tools` (advanced / legacy use).
///View on GitHub (pinned to 0c42157ee5)
Solutions
- Call the Bash tool without the interactive flag to run a normal one-shot shell command.
- Set background=true on the Bash call to run the command without attaching to the parent TUI's terminal.
- Set tty=true on the Bash call if a pseudo-terminal is needed, without interactive ownership.
- Use the task_shell_start tool to run an interactive shell as a managed background task the sub-agent can poll.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/tui/src/tools/subagent/mod.rs:15172 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/d1654883cfa11f6f.
Report an issue: GitHub.