[BUG] Advisor: a response that stops with pause_turn ends the turn with error_during_execution in -p / stream-json (2.1.326)

Open
#110,623 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
1-2 days
Newbie friendliness
52/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
typescript

Research direction

Start by tracing how non-interactive -p runs handle API responses with stop_reason: "pause_turn", including both JSON output and stream-json input/output paths. Reproduce with the advisor configured and 12 consecutive calls, then compare with a 9-call run. Done means the paused turn resumes and completes in both modes.

Written by the indexing model from the issue text.

Description

area:cli area:model bug has repro

Claude Code 2.1.326, non-interactive (-p, with --output-format json, and with --input-format stream-json --output-format stream-json).

After a run of about 10 advisor (server tool) calls with no client tool between them, the API stops the response with stop_reason: "pause_turn". Claude Code then ends the turn with error_during_execution instead of resuming it:

{"type":"result","subtype":"error_during_execution","is_error":true,"stop_reason":"pause_turn",
 "errors":["[ede_diagnostic] result_type=assistant last_content_type=server_tool_use stop_reason=pause_turn"]}

Repro (with advisorModel set, e.g. fable):

claude -p --model opus "Call your advisor tool exactly 12 times, one call after another. Between calls write only the line 'advisor call N done'. Use no other tools."

Expected: the paused turn is resumed and finishes.
Seen: exit 1 after 10 calls (-p, json) and after 11 calls (stream-json in and out). Runs asking for 9 calls succeed.

Dominant language
TypeScript
Stars
156k
Forks
25k
Avg merge
16h 19m
Merged PRs (30d)
5

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

  • No Dockerfile or Docker Compose file
  • No pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from anthropics/claude-code

All issues in anthropics/claude-code

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.