claude-code - 💡(How to fix) Fix Agent Teams: subagent crashes with <Box> in <Text> Ink error on sensitive-path Edit/Write [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#52337Fetched 2026-04-24 06:09:51
View on GitHub
Comments
0
Participants
1
Timeline
8
Reactions
2
Participants
Timeline (top)
labeled ×6cross-referenced ×1referenced ×1

Claude Code 2.1.117 and 2.1.118 subagents spawned in experimental Agent Teams mode crash with an Ink rendering error whenever the subagent issues an Edit or Write tool call targeting a file inside a "sensitive" path (e.g. .claude/commands/). Crash is reproducible, does not depend on mode: bypassPermissions, and does not fire on Read of the same path — only on Edit/Write.

Error Message

ERROR  <Box> can't be nested inside <Text> component

  at createInstance (cli.js:495:249)
  at BU (cli.js:477:57938)
  at gTH (cli.js:477:87786)
  at XWH (cli.js:477:86997)
  at bgH (cli.js:477:85896)
  at Ir (cli.js:477:85717)
  at MWH (cli.js:477:82456)
  at T_ (cli.js:477:6497)
  at hH (cli.js:477:4980)
  at eH (cli.js:477:5281)

The Ink host-config createInstance rejects an ink-box created while the parent context has isInsideText: true. Almost certainly a <Box> element nested inside a <Text> wrapper within the sensitive-file Edit confirmation / preview UI component.

Root Cause

Blocks any workflow where team subagents must edit Claude Code config files (.claude/commands/, .claude/skills/, ~/.claude/settings.json, etc.). Because experimental Agent Teams is foundational to multi-agent pipelines, this bug blocks self-modifying pipeline rewrites and similar infrastructure work.

Fix Action

Workaround

Parent session performs edits on sensitive paths. Team subagents are restricted to edits on non-sensitive paths (code, docs, tests). Reviewer subagents (Read-only) remain safe.

Code Example

Agent({
     subagent_type: "general-purpose",
     team_name: "<any>",
     name: "<any>"
   })

---

ERROR  <Box> can't be nested inside <Text> component

  at createInstance (cli.js:495:249)
  at BU (cli.js:477:57938)
  at gTH (cli.js:477:87786)
  at XWH (cli.js:477:86997)
  at bgH (cli.js:477:85896)
  at Ir (cli.js:477:85717)
  at MWH (cli.js:477:82456)
  at T_ (cli.js:477:6497)
  at hH (cli.js:477:4980)
  at eH (cli.js:477:5281)
RAW_BUFFERClick to expand / collapse

Summary

Claude Code 2.1.117 and 2.1.118 subagents spawned in experimental Agent Teams mode crash with an Ink rendering error whenever the subagent issues an Edit or Write tool call targeting a file inside a "sensitive" path (e.g. .claude/commands/). Crash is reproducible, does not depend on mode: bypassPermissions, and does not fire on Read of the same path — only on Edit/Write.

Reproduction

  1. Enable experimental teams: CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 in ~/.claude/settings.json.
  2. Parent session started with --dangerously-skip-permissions.
  3. From parent, spawn a subagent via the Agent tool:
    Agent({
      subagent_type: "general-purpose",
      team_name: "<any>",
      name: "<any>"
    })
  4. In the spawn prompt, direct the subagent to Edit or Write any file inside .claude/commands/ or another sensitive path.
  5. Subagent crashes the moment the tool call is processed.

Error

ERROR  <Box> can't be nested inside <Text> component

  at createInstance (cli.js:495:249)
  at BU (cli.js:477:57938)
  at gTH (cli.js:477:87786)
  at XWH (cli.js:477:86997)
  at bgH (cli.js:477:85896)
  at Ir (cli.js:477:85717)
  at MWH (cli.js:477:82456)
  at T_ (cli.js:477:6497)
  at hH (cli.js:477:4980)
  at eH (cli.js:477:5281)

The Ink host-config createInstance rejects an ink-box created while the parent context has isInsideText: true. Almost certainly a <Box> element nested inside a <Text> wrapper within the sensitive-file Edit confirmation / preview UI component.

Differential matrix (all tested on 2.1.117, same session)

modeTarget pathResult
(none)/tmp/<file>pass
(none)<worktree>/tmp/<file>pass
(none).claude/commands/<file> (Read only)pass
(none).claude/commands/<file> (Edit)crash
bypassPermissions/tmp/<file>pass
bypassPermissions.claude/commands/<file> (Edit)crash

What was ruled out

  • Permission prompts. Parent runs with --dangerously-skip-permissions; no prompt fires before the crash.
  • Custom statusline. Removing statusLine config did not change behavior.
  • Worktree path. Crash fires whether spawn CWD is main repo or worktree.
  • Workload volume. Light workloads (single Edit) crash identically to heavy workloads.
  • mode: bypassPermissions itself. Non-bypass spawns crash identically on sensitive-path Edit.
  • Skill load. Probes that loaded bmad-agent-dev and probes that did not both crash when the Edit targets a sensitive path.

Environment

  • Claude Code: 2.1.117 (also reproduces on 2.1.118)
  • OS: macOS (Darwin 25.4.0)
  • Terminal: tmux (subagents use backendType: "tmux")
  • Experimental feature: CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1

Workaround

Parent session performs edits on sensitive paths. Team subagents are restricted to edits on non-sensitive paths (code, docs, tests). Reviewer subagents (Read-only) remain safe.

Impact

Blocks any workflow where team subagents must edit Claude Code config files (.claude/commands/, .claude/skills/, ~/.claude/settings.json, etc.). Because experimental Agent Teams is foundational to multi-agent pipelines, this bug blocks self-modifying pipeline rewrites and similar infrastructure work.

Likely area to inspect

The JSX rendering the sensitive-file Edit confirmation/preview in the subagent TUI. Most likely a <Box> placed inside a <Text> parent, only reachable when isSensitivePath(target) is true. Read paths are fine, so the bug is specifically in the Edit/Write confirmation render path, not the tool itself.

extent analysis

TL;DR

The most likely fix is to modify the JSX rendering of the sensitive-file Edit confirmation/preview in the subagent TUI to avoid nesting a <Box> inside a <Text> component.

Guidance

  • Inspect the JSX code responsible for rendering the sensitive-file Edit confirmation/preview in the subagent TUI, focusing on the isSensitivePath(target) condition.
  • Verify that the crash occurs only when the subagent attempts to Edit or Write a file inside a sensitive path, and not when reading the same path.
  • Check the Ink host-config createInstance method to ensure it correctly handles the creation of ink-box elements when the parent context has isInsideText: true.
  • Consider implementing a temporary workaround by restricting team subagents to edits on non-sensitive paths, as described in the issue's "Workaround" section.

Example

No code snippet is provided, as the issue does not contain sufficient information to create a specific example.

Notes

The issue seems to be related to the rendering of the sensitive-file Edit confirmation/preview UI component, and the crash occurs only when the subagent attempts to Edit or Write a file inside a sensitive path. The provided error message suggests that the issue is caused by a <Box> element being nested inside a <Text> component.

Recommendation

Apply a workaround by restricting team subagents to edits on non-sensitive paths, as this will allow workflows to continue while the root cause of the issue is investigated and fixed.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING