[BUG] Agent Teams: tmux/auto teammates crash on spawn — non-TTY stdin triggers --print with no prompt (2.1.195)
Summary
With teammateMode: "tmux" (or "auto" inside tmux), every spawned teammate dies on launch with:
Error: Input must be provided either through stdin or as a prompt argument when using --print
The tmux pane exits with status 1 and shows "Pane is dead". The teammate never starts.
The root cause is that the teammate subprocess is launched with a non-TTY stdin. Claude Code treats a non-TTY stdin as headless/--print mode, but the spawn path does not feed the teammate's initial prompt on that channel — so it reaches --print with neither stdin input nor a prompt argument, and aborts.
This is not specific to my setup: the existing report chain includes a Vertex AI backend variant with no tmux/wrapper involved (#27729). Those reports — #27729 → #29293 → #58724 — were each auto-closed as duplicates by the triage bot and locked, and no fix ever shipped. It still reproduces on the latest release.
Environment
- Claude Code 2.1.195
- OS: NixOS (Linux), tmux as the terminal multiplexer
CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1teammateMode: "auto"(tmux present, so the split-pane backend is selected)
Reproduction
CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1,teammateMode: "auto"(or"tmux"), inside a tmux session.- Ask Claude to spawn any named teammate (Agent tool with a
name). - A new tmux pane opens, then immediately dies: "Pane is dead (status 1)".
- Capturing the dead pane's scrollback shows the
--printerror above.
Decisive isolation (stdin TTY is the only variable)
I captured the exact command Claude ran for the pane (tmux pane_start_command) and replayed it three ways. Only stdin differs:
| How the identical command was run | stdin | Result |
|---|---|---|
| Under a real PTY (script -qec '<cmd>' /dev/null) | TTY | ✅ Teammate TUI boots normally and runs |
| <cmd> </dev/null | not a TTY | ❌ Error: Input must be provided … --print, exit 1 |
| The real teammate pane Claude spawned | (effectively non-TTY) | ❌ same error, exit 1, dead pane |
The launch line itself is correct (right binary, flags, --model, settings) — it succeeds the moment stdin is a TTY. So the bug is that the tmux/auto spawn backend gives the teammate a non-TTY stdin (and/or fails to pass the initial prompt on the channel it expects).
Expected
A teammate spawned in tmux/auto mode starts interactively in its pane and receives its initial task (via the mailbox / prompt), the same way it does in in-process mode.
Actual
The teammate process enters --print mode due to non-TTY stdin, finds no prompt, and exits 1 — leaving a dead pane. Team work is impossible in split-pane mode.
Workaround
Set teammateMode: "in-process" (also the default since 2.1.179). Teammates then run in the main session and work correctly — at the cost of split-pane visibility.
Note for triage
Please do not auto-close this as a duplicate of #27729 / #29293 / #58724 — those are the same unresolved bug, were closed by the dedupe bot without a fix, and are now locked so they can't be reopened. This report adds a minimal stdin-TTY isolation that should make the fix straightforward (allocate a PTY for the teammate pane, or pass the prompt as an argument instead of relying on stdin).
Showing cached comments. Read the full discussion on GitHub ↗
6 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
Please keep this open rather than auto-closing as a duplicate. All three cited issues are closed, and none were fixed:
NOT_PLANNEDon 2026-06-23 ("inactive for too long") — even though it was labeledbug/has repro/area:agentsand independently reached the same root cause this issue identifies: the harness spawns the teammate without a PTY, so Claude sees a non-TTY stdin, auto-enables--print, and dies with no prompt.That independent corroboration is the point: this is one unfixed bug that keeps getting reported and auto-closed without a fix ever shipping. This issue reproduces on the latest release (2.1.195) and adds a minimal stdin-TTY isolation (identical launch line: ✅ under a PTY, ❌ without). Please leave it open as the live tracking issue for the no-PTY teammate spawn failure. 👎 to auto-closure.
The core issue here is that the spawn path for tmux teammates doesn't allocate a PTY before exec, so Claude Code's own stdin-detection heuristic sees a non-TTY and falls into --print mode without a prompt to consume. It then fails rather than waiting for mailbox input.
The PTY allocation fix is the right long-term answer. In the meantime, a few workarounds beyond in-process mode that some people have had luck with:
script -q /dev/null claude ...on macOS to force PTY allocationexpect -c 'spawn claude ...; interact'to get a PTY without an interactive terminalThe regression from 2.1.179 is worth flagging separately: in-process mode losing split-pane visibility is a real cost. The tmux split-pane path was the whole point of teammateMode for monitoring what each agent is actually doing. Losing that visibility makes it harder to catch when a teammate has gone off the rails.
Seconding the request for a fix that keeps split-pane visibility while getting PTY stdin right.
Some code-level detail from the shipped 2.1.195 bundle (
GIT_SHA 4603aa3f2ea164bd0974f82eb413ae7acc99a7ee), in case it helps whoever picks this up. This is not environment-specific — the relevant code is in the binary itself, and the same failure has been reported on macOS (#60987, labeledplatform:macos) and against the Vertex AI backend (#27729), neither of which involves tmux or a Nix wrapper.Spawn path. The teammate is launched via the agent runner with:
i.e. it re-invokes its own binary by absolute path. The child is given a non-TTY stdin, so Claude's stdin heuristic falls into
--printmode and then aborts because there's no prompt on stdin — instead of allocating a PTY or passing the initial prompt as an argument. (CLAUDE_CODE_EXECPATHis only written into the child env viagetEnvironmentOverrides—c[Gmo]=process.execPath— it is not read as an override.)The fix is already in the box. The bundle ships
node-pty(@cdktf/node-pty-prebuilt-multiarch) and a background-agent PTY rendezvous mechanism (CLAUDE_BG_PTY_AUTH,CLAUDE_BG_SOCKET_TOKENS_PATH). Thetmux/autoteammate spawn path just doesn't route through it — it spawns with a piped stdin instead. Routing tmux teammates through the same PTY path (or passing the initial prompt as-pto sidestep the stdin ambiguity entirely) should resolve it.Why the community workarounds don't generalize.
script -q … claude …/expect -c 'spawn claude …'all assume you control the spawn command. Because the spawn targetsprocess.execPathdirectly, packaged installs — the official versioned binary, Homebrew, Nix — have no wrapper seam to inject a PTY: the spawn steps over anyclaudewrapper script and calls the real binary. Soin-process(also the default since 2.1.179) is the only general workaround, and the fix really does need to live in the spawn path.Repro is in the issue body: the identical launch line succeeds under a PTY (
script -qec '<line>' /dev/null) and fails with--printwithout one — stdin's TTY-ness is the only variable.Thanks for the detailed isolation work. I tried to reproduce this on Linux with tmux 3.4 on 2.1.233:
CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1,"teammateMode": "tmux", running inside tmux, then asking Claude to spawn a teammate named alice. The teammate pane opened and started a normal interactive session that received its instructions and replied — no crash. I then repeated the exact same steps on 2.1.195 (your version) and it also worked, and even forcingclaude </dev/nullinside a tmux pane starts interactively on both versions.One note on the diagnosis: bare
claudedecides between interactive and--printmode based on whether stdout is a terminal, not stdin (docs) — piped stdin alone is recovered via/dev/tty. So the dead pane suggests something in your environment is making the spawned command's stdout not a TTY inside the pane.Could you share:
which clauderesolves to a wrapper script — if so, its contentsdefault-shell/default-commandsettings (tmux show -g default-shell default-command)sh -c 'tty; ls -l /proc/$$/fd/0 /proc/$$/fd/1'run viatmux respawn-pane🤖 Generated with Claude Code
We weren't able to reproduce this. Could you provide steps to trigger the issue — what you ran, what happened, and what you expected? This issue will be closed automatically if there's no activity within 7 days.