[BUG] Agent-team teammate pane crashes with "<Box> can't be nested inside <Text>" when ※ recap renders inline markdown code spans

Resolved 💬 14 comments Opened Apr 22, 2026 by RY94 Closed Apr 23, 2026

Title: [BUG] Agent-team teammate pane crashes with "<Box> can't be nested inside <Text>" when ※ recap renders inline markdown code spans

Summary

In Claude Code v2.1.117 agent-teams mode, if a teammate's reply to team-lead contains inline markdown code spans (backtick-delimited text like ` uv run python ), the teammate's own pane crashes when Claude Code renders the ※ recap: compact-summary line. The Ink reconciler throws Error: <Box> can't be nested inside <Text> component from createInstance at cli.js:495:249. The crashed pane subsequently causes the whole team directory (~/.claude/teams/{name}/`) to be torn down, cascading to all other teammates.

This is distinct from #49865 (different error, different line, different trigger — and #49865 is fixed as of v2.1.114).

Environment

  • Claude Code: v2.1.117 (confirmed), v2.1.116 (strongly suspected based on retrospective matching against prior session stalls, not re-tested)
  • Platform: macOS (Darwin 24.5.0)
  • Terminal: iTerm2 inside tmux (tmux -CC control mode)
  • Model: Sonnet 4.6 / Opus 4.7 (both observed)
  • Feature flag: CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1

Error (verbatim, from crashed pane)

Error: <Box> can't be nested inside <Text> component
    at createInstance  /$bunfs/root/src/entrypoints/cli.js:495:249
    at BU              cli.js:477:57938
    at gTH / XWH / bgH / Ir / MWH / T_ / hH / eH
       (React Fiber reconciler + Ink host config work loop)

The throw site in the bundled source:

createInstance(H, _, q, K, O) {
  if (K.isInsideText && H === "ink-box")
    throw Error("<Box> can't be nested inside <Text> component");

Combined with the host-context tracker a few lines earlier:

getChildHostContext(H, _) {
  let q = H.isInsideText,
      K = _ === "ink-text" || _ === "ink-virtual-text" || _ === "ink-link";
  if (q === K) return H;
  return { isInsideText: K };
}

This confirms an ink-box host element is being mounted while the parent context has isInsideText: true.

Reproduction

  1. Start a Claude Code session with CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1.
  2. Call TeamCreate to create a team.
  3. Spawn a teammate via Agent(subagent_type=..., team_name=..., name=...) whose persona or spawn prompt encourages replies containing inline code formatting. (I reproduced with an agent whose spawn reply included the phrase ` uv run python `, but any backtick-delimited inline code in the reply is sufficient.)
  4. After the teammate sends its first reply to team-lead and goes idle, Claude Code renders the ※ recap: compact summary in the teammate's own pane.
  5. At that render, the crash fires. Pane shows Ink error-boundary fallback (which, with tmux alternate-screen off, also mis-paints and dumps bundled cli.js source into the pane).
  6. The whole team directory is torn down shortly after.

Expected: recap renders code spans inline, like the main message render does.
Actual: Ink reconciler throws from createInstance, pane enters zombie state, team is torn down.

Root-cause hypothesis

The ※ recap: component structure appears to be:

<Text>
  ※ recap: <InlineMarkdown content={previewText}/>
</Text>

Where InlineMarkdown emits a <Box> wrapper for code spans (for background-color / padding visual treatment):

<Box backgroundColor="gray" paddingX={1}>
  <Text>uv run python</Text>
</Box>

The <Box> lands inside the outer <Text> wrapper → violates Ink's getChildHostContext invariant → throw.

Suggested fix

Two clean options:

Option A — change recap's outer wrapper from <Text> to <Box>, move prefix into inner <Text>:

// Buggy:
<Text>
  ※ recap: <InlineMarkdown content={preview}/>
</Text>

// Fixed:
<Box>
  <Text>※ recap: </Text>
  <InlineMarkdown content={preview}/>
</Box>

Option B — change the inline-code-span renderer to use <Text>-level styling instead of <Box> wrapping:

// Buggy:
<Box backgroundColor="gray" paddingX={1}><Text>{code}</Text></Box>

// Fixed:
<Text backgroundColor="gray"> {code} </Text>

Option B is probably more robust because it fixes the code-span component regardless of where it's used.

Evidence the bug is specific to recap rendering (not message receipt)

The main message render in team-lead's pane rendered the same backticked content correctly. Only the ※ recap: line in the teammate's own pane crashed. That points at a separate renderer path that wraps message content in a stricter container.

Selective-crash pattern across a 5-agent team

In one session, spawned 5 teammates. Only the two whose replies/received-content included backticks crashed:

| teammate | reply content | backticks? | outcome |
|---|---|---|---|
| planner | bare idle | no | clean |
| dev | bare idle | no | clean |
| qa | bare idle on spawn; later received brief with backticks from team-lead | no / yes (later) | clean on spawn, silent-stall later |
| researcher | bare idle | no | clean |
| tester | multi-line narrative with ` uv run python ` | yes | pane crash + source dump |

Also: crash fires mid-render of the ※ recap: line specifically — ✶ Doing… / ✢ Doing… status lines (which lack backticks) rendered cleanly before the crash.

Amplifier (orthogonal, self-fixed)

If the user's ~/.tmux.conf has set-option -g alternate-screen off, the Ink error-boundary fallback mis-paints and dumps ~2000 lines of bundled cli.js source into the pane (reproduced this myself). With tmux's default alternate-screen on, the fallback renders a clean error screen. This is user-side config and not Claude Code's responsibility, but worth noting for anyone reproducing.

Related issues

  • #49865 — getAppState is not a function crash on permission-prompt render. Different bug, fixed in v2.1.114. I initially wondered if they were related; they are not.

Workaround (current)

Include an explicit directive in teammate spawn prompts to ban backticks in SendMessage replies. Example: "NEVER use backticks, code fences, or inline code formatting in SendMessage content. Reference paths and identifiers as plain prose." This sidesteps the crash but is fragile (depends on agent compliance).

View original on GitHub ↗

This issue has 14 comments on GitHub. Read the full discussion on GitHub ↗