{"record":{"id":"d1654883cfa11f6f","repo":"Hmbown/CodeWhale","slug":"sub-agents-run-in-the-background-and-cannot-use-ba","errorCode":null,"errorMessage":"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.","messagePattern":"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\\.","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/tui/src/tools/subagent/mod.rs","lineNumber":15172,"sourceCode":"    };\n    raw_paths\n        .into_iter()\n        .map(|path| normalize_claim_path(&path).map_err(anyhow::Error::msg))\n        .collect()\n}\n\nfn reject_subagent_terminal_takeover(name: &str, input: &Value) -> Result<()> {\n    let wants_interactive_shell = matches!(name, \"bash\" | \"Bash\" | \"exec_shell\")\n        && input\n            .get(\"action\")\n            .and_then(Value::as_str)\n            .is_none_or(|action| action == \"run\")\n        && input\n            .get(\"interactive\")\n            .and_then(Value::as_bool)\n            .unwrap_or(false);\n    if wants_interactive_shell {\n        return Err(anyhow!(\n            \"Sub-agents run in the background and cannot use Bash with interactive=true \\\n             because that would take over the parent TUI terminal. Use Bash without \\\n             interactive, or with background=true / tty=true, or task_shell_start \\\n             instead.\"\n        ));\n    }\n    Ok(())\n}\n\n/// Resolve the effective allowed-tools list for a child.\n///\n/// **v0.6.6 default: full inheritance.** Returning `Ok(None)` means the\n/// child sees the same tool surface as the parent's Agent mode — every\n/// family including `with_subagent_tools` so it can recurse. The narrowing\n/// path (`Ok(Some(list))`) is only used by:\n/// - `Custom` agent types (which require an explicit list).\n/// - Callers that pass `explicit_tools` (advanced / legacy use).\n///","sourceCodeStart":15154,"sourceCodeEnd":15190,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/0c42157ee52f9d55af2b506d71b46249910f77d3/crates/tui/src/tools/subagent/mod.rs#L15154-L15190","documentation":"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.","triggerScenarios":"Thrown at crates/tui/src/tools/subagent/mod.rs:15172 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0c42157ee52f9d55af2b506d71b46249910f77d3","analyzedAt":"2026-08-20T21:50:45.477Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}