CLI crash: stack-overflow recursion in AskUserQuestion render path while idle (no question pending)
Environment
- Claude Code: v2.1.112
- Model: Opus 4.7 (claude-opus-4-7)
- Platform: macOS 15.3 (Darwin arm64)
Description
CLI crashed with infinite-recursion stack dump while a foreground session was
idle, waiting on sub-agent results. The crash dumped a large chunk of
minified cli.js to the terminal and killed the foreground process; orphaned
sub-agent sessions kept writing to their transcripts for ~3 minutes before
stopping (presumably when their parent's death was detected).
The foreground assistant never invoked AskUserQuestion, EnterPlanMode, orExitPlanMode — yet the crash trace is in the AskUserQuestion / plan-mode
interview render path.
Workload shape
- Foreground session was coordinating a team of 5 sub-agents running in
parallel git worktrees, communicating via SendMessage.
- At time of crash, foreground was idle, awaiting completion messages from
the sub-agents. No user input was pending.
Crash trace (head + tail)
Crash site: cli.js:8231:15642 — inside the function that fires thetengu_ask_user_question_finish_plan_interview analytics event and awaitsxf8(g, i) (image attachment processing) for the AskUserQuestiononAllow / onReject callbacks.
Stack tail shows tight recursion:
- <anonymous> (cli.js:8231:15642)
- qX (cli.js:477:63169)
- sPH (cli.js:477:76220)
- ov (cli.js:477:76101)
- sPH (cli.js:477:76199)
- ov (cli.js:477:76101)
- sPH (cli.js:477:76199)
- ov (cli.js:477:76101)
...repeats...
sPH ↔ ov looks like a React error-boundary / effect re-render loop.
Transcript evidence
Final entries of the foreground transcript (redacted), in order:
T+0 user <teammate-message teammate_id="quality-reviewer" summary="Worktree verified, ready for review">
Worktree verified at <worktree-path>. WORKTREE OK. Ready to receive tickets.
</teammate-message>
<teammate-message teammate_id="quality-reviewer">
{"type":"idle_notification","from":"quality-reviewer","idleReason":"available"}
</teammate-message>
T+3s assistant TEXT: "Quality-reviewer verified. All 5 agents ready; 3 implementers
working. Awaiting DONE signals."
T+3.2s system stop_hook_summary (clean, no error)
[no further entries — transcript ends here]
- Tool-use census on the foreground session over its full lifetime:
18× Bash, 5× Agent, 3× SendMessage, 3× Read, 3× TaskCreate, 1× Grep,
1× ToolSearch, 1× TeamCreate.
0× AskUserQuestion, 0× EnterPlanMode, 0× ExitPlanMode.
- Sub-agent transcripts continued writing for ~3 minutes after the
foreground transcript ended, then stopped abruptly.
Reproduction
Not reliably reproducible. Happens intermittently in workloads that
coordinate multiple parallel sub-agents over SendMessage.
Possibly related
- #16918 (closed as dup of #16871) — same symptom (RangeError stack overflow
during AskUserQuestion render after parallel agents completed) on v2.1.1,
closed 2026-01-08. The current crash on v2.1.112 may be a regression or
a related uncovered code path.
Impact
- Foreground CLI dies; user loses interactive session.
- Sub-agent processes are orphaned and continue running for several minutes
(related to #20369 / #19045).
- Any in-flight coordination state is lost.
What should happen
- The CLI should not crash while idle.
- If the AskUserQuestion / plan-interview render path is being entered
spuriously (no user-facing question pending), entry should be guarded.
- If a render does fail, the error boundary should report and recover, not
recurse.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗