[Bug] Ink renderer crashes in spawned teammate agents during tmux mode sessions
Bug Description
# Ink renderer crashes in spawned teammate agents (tmux mode)
## Summary
Claude Code's Ink renderer (React-for-terminal) is crashing repeatedly inside spawned teammate agents during an agent-team session. The crashes happen in the teammate subprocess (tmux pane), not the main session. Stack trace points into createInstance inside the Ink reconciler in the bun-packed cli.js. Crashes appear to be triggered by something about the content a teammate produces or receives — possibly very long single-line text (e.g., an unwrapped dotnet build error) or a specific character sequence.
Affected teammates in this session: both a general-purpose worker (opus-4-7) and a custom read-only godot-mcp proxy (haiku-4-5). Occurred at least three times during a single ~2-hour session of focused implementation work.
## Environment
- Claude Code version: 2.1.117 (from --agent-id args visible in ps)
- OS: macOS / Darwin 25.3.0
- Shell: zsh
- Teammate mode: tmux (teammateMode: "tmux" in ~/.claude.json)
- Experimental feature: CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 enabled
- Binary shape: bun-packed (/$bunfs/root/src/entrypoints/cli.js)
- Agent types active: general-purpose (Opus 4.7), custom godot-mcp subagent (Haiku 4.5)
- MCP servers in play: godot-mcp-pro (some queries to a running Godot 4 editor)
## Repro pattern (not a minimal repro, but the triggering workload)
1. Create a team via TeamCreate.
2. Spawn two teammates: a worker and a read-only MCP proxy.
3. Give the worker a task that involves running dotnet build and/or coordinating with the MCP proxy for editor queries.
4. At some point during the work, the worker's or proxy's subprocess crashes. The tmux pane shows a long minified JS stack trace with fragments ending in createInstance in the Ink reconciler.
Crashes observed during:
- MCP tool invocations that return moderately large results (scene trees, execute_editor_script output)
- Shortly after running dotnet build whose output included compiler errors (unclear if the error output itself was the trigger)
- Teammate activity in general once the session had been running for a while
## Stack trace fragments (top of the relevant frames)
``
- createInstance (/$bunfs/root/src/entrypoints/cli.js:495:249)
- BU (/$bunfs/root/src/entrypoints/cli.js:477:57938)
- gTH (/$bunfs/root/src/entrypoints/cli.js:477:87786)
- XWH (/$bunfs/root/src/entrypoints/cli.js:477:86997)
- bgH (/$bunfs/root/src/entrypoints/cli.js:477:85896)
- Ir (/$bunfs/root/src/entrypoints/cli.js:477:85717)
- MWH (/$bunfs/root/src/entrypoints/cli.js:477:82456)
- T_ (/$bunfs/root/src/entrypoints/cli.js:477:6497)
- hH (/$bunfs/root/src/entrypoints/cli.js:477:4980)
- eH (/$bunfs/root/src/entrypoints/cli.js:477:5281)
`
The surrounding minified source shows the Ink reconciler's createInstance and its nearby isInsideText/textStyles handling (ink-text, ink-virtual-text, ink-box host contexts). A <Box> nested inside a <Text> throws ("<Box> can't be nested inside <Text> component"), which suggests the crash may be a React invariant from malformed element trees produced by the reconciler under certain content.
## Impact
- **Loss of in-flight agent work** — the teammate subprocess dies mid-task; any uncommitted edits in that agent's workspace survive on disk, but the subprocess can't be resumed. Recovery requires spawning a fresh teammate and re-briefing.
- **Zombie state** — crashed teammates remain tracked as "active members" in the team config (~/.claude/teams/<name>/config.json, isActive: true), blocking TeamDelete. Cleanup requires either killing the orphan OS process (SIGTERM was ignored; SIGKILL worked), killing the tmux pane (tmux kill-pane -t %<id>), and then hand-editing the config to flip isActive: false before TeamDelete will accept the cleanup. This recovery path is not discoverable — users stuck in this state would likely just restart their whole session.
- **Works around, doesn't fix** — we've mitigated by piping dotnet build through | tail -30 and telling the MCP proxy to summarize rather than relay raw tool results. These are plausibly the trigger, but the root cause is unclear.
## Asks
1. Ideally: fix the Ink-layer crash (React invariant around ink-text/ink-box nesting, possibly a content-type issue).
2. Failing that: **a supported cleanup path for zombie teammates** — a --force flag on TeamDelete or a "mark member inactive" mechanism that doesn't require hand-editing JSON.
3. Optional nice-to-have: the crash output would be more useful if Claude Code captured it into a log file rather than only the tmux pane, so users can recover it after closing the pane.
## Additional context
If it helps, I'm happy to share:
- The full session transcript leading up to the crashes
- The ~/.claude/teams/<name>/config.json contents
- The scenario files (Godot C# project using Nav…
Note: Content was truncated.
This issue has 6 comments on GitHub. Read the full discussion on GitHub ↗