claude-code - 💡(How to fix) Fix [Bug] v2.1.109 / Opus 4.7 — silent stuck-turn during tool execution (two distinct failure modes) [6 comments, 2 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#50727Fetched 2026-04-20 12:14:44
View on GitHub
Comments
6
Participants
2
Timeline
11
Reactions
0
Author
Timeline (top)
commented ×6labeled ×4closed ×1

Running a long-lived interactive session via claude --channels plugin:telegram@claude-plugins-official under systemd, we hit the model in a permanently stuck state — stop_reason: tool_use but no follow-on activity. The session stops processing, no error is emitted, the process stays alive. Two distinct stuck flavors observed in a single day, both on the same agent doing the same task class.

Error Message

Running a long-lived interactive session via claude --channels plugin:telegram@claude-plugins-official under systemd, we hit the model in a permanently stuck state — stop_reason: tool_use but no follow-on activity. The session stops processing, no error is emitted, the process stays alive. Two distinct stuck flavors observed in a single day, both on the same agent doing the same task class. 3. Is there a way to surface the hang as an error (exit code, SIGTERM, or at least an error line in the JSONL) instead of silent freeze? Currently there's no signal from the CLI — the process stays running, the session stays "active," but no tool is executing and no assistant turn is advancing.

Root Cause

Running a long-lived interactive session via claude --channels plugin:telegram@claude-plugins-official under systemd, we hit the model in a permanently stuck state — stop_reason: tool_use but no follow-on activity. The session stops processing, no error is emitted, the process stays alive. Two distinct stuck flavors observed in a single day, both on the same agent doing the same task class.

Fix Action

Fix / Workaround

stop_reason: tool_use. No matching tool_result ever written to JSONL. File on disk untouched. Subsequent queue-operation enqueue entries from the TG plugin piled up but the session could not dispatch them (turn still open).

All tool_use/tool_result IDs matched cleanly (60/60). The turn was not closed. JSONL stopped growing except for a single queue-operation enqueue 7 minutes later when the user's follow-up message arrived (also never dispatched).

Code Example

{
  "type": "tool_use",
  "id": "toolu_01NeNUJdzhBeeckre3Zxm5TD",
  "name": "Edit",
  "input": {
    "file_path": ".../skills/holder-scanner/scripts/scan_holders.sh",
    "old_string": "<263 chars, ASCII-only, a bash variable block>",
    "new_string": "<626 chars, ASCII-only, adds a sourced helper block>",
    "replace_all": false
  }
}

---

{
  "type": "tool_use",
  "name": "Read",
  "input": {
    "file_path": ".../skills/holder-scanner/scripts/scan_holders.sh",
    "offset": 1,
    "limit": 40
  }
}
RAW_BUFFERClick to expand / collapse

[Bug] Claude Code v2.1.109 / Opus 4.7 — silent stuck-turn during tool execution (two distinct failure modes)

Summary

Running a long-lived interactive session via claude --channels plugin:telegram@claude-plugins-official under systemd, we hit the model in a permanently stuck state — stop_reason: tool_use but no follow-on activity. The session stops processing, no error is emitted, the process stays alive. Two distinct stuck flavors observed in a single day, both on the same agent doing the same task class.

Environment

  • Claude Code CLI: v2.1.109
  • Model: claude-opus-4-7 (1M context)
  • Host: Ubuntu 24.04 on AWS EC2 t3.micro (1.9 GB RAM)
  • Launched via: script -qec "claude --channels plugin:telegram@claude-plugins-official --dangerously-skip-permissions --disallowedTools mcp__telegram-mcp__tg_send" /dev/null under systemd Restart=always
  • Working directory: a git repo with CLAUDE.md, .mcp.json, a local .claude/skills/ tree
  • Effort level: CLAUDE_CODE_EFFORT_LEVEL=max
  • Auto-memory disabled: CLAUDE_CODE_DISABLE_AUTO_MEMORY=1
  • Auto-updater disabled: DISABLE_AUTOUPDATER=1

Failure mode A — Edit tool_use with no tool_result

When: 2026-04-19 11:13:43 UTC Session: 1a642596-ee80-4d9e-bf8a-eee474d4e82a Last JSONL assistant entry:

{
  "type": "tool_use",
  "id": "toolu_01NeNUJdzhBeeckre3Zxm5TD",
  "name": "Edit",
  "input": {
    "file_path": ".../skills/holder-scanner/scripts/scan_holders.sh",
    "old_string": "<263 chars, ASCII-only, a bash variable block>",
    "new_string": "<626 chars, ASCII-only, adds a sourced helper block>",
    "replace_all": false
  }
}

stop_reason: tool_use. No matching tool_result ever written to JSONL. File on disk untouched. Subsequent queue-operation enqueue entries from the TG plugin piled up but the session could not dispatch them (turn still open).

Preceding context: 14 tool calls (Bash, Grep, Read, Write chains) in the 90 seconds before the stuck Edit. No errors in any of those results.

Failure mode B — assistant never emits next message after a successful tool_result

When: 2026-04-19 09:36:29 UTC Session: fc891dc4-a248-4d22-949e-3b061660c307 Last JSONL assistant entry:

{
  "type": "tool_use",
  "name": "Read",
  "input": {
    "file_path": ".../skills/holder-scanner/scripts/scan_holders.sh",
    "offset": 1,
    "limit": 40
  }
}

This is different from mode A. The tool_result WAS written (file content returned normally). But the model never produced the next assistant message — no text, no further tool_use, no end_turn. The stop_reason of that last assistant entry was tool_use, meaning the model expected to continue the turn. It just... stopped.

All tool_use/tool_result IDs matched cleanly (60/60). The turn was not closed. JSONL stopped growing except for a single queue-operation enqueue 7 minutes later when the user's follow-up message arrived (also never dispatched).

Shared signature

Both sessions exhibited tool_use:end_turn stop ratios far outside the norm:

Sessiontool_use stopsend_turn stopsRatio
fc891dc4 (mode B, 09:36)60230.0
1a642596 (mode A, 11:13)32132.0
Baseline across 10 healthy sessions Apr 17-183.0 — 7.0

So the stuck-turn correlates with the model chaining unusually many tools before the hang. Both runs involved heavy compound work (committing coordinated code changes after a peer review, touching multiple files).

What we ruled out

  • TG channel plugin is not involved — it only delivers inbound messages and handles the reply tool. The hang is upstream of message delivery, inside Claude Code's tool execution / turn generation.
  • bun subprocess was alive and healthy throughout both hangs.
  • MCP configuration — we cycled between ENABLE_TOOL_SEARCH=false (eager) and default (deferred), and between full .mcp.json and {"mcpServers": {}}. Both stuck-turns recurred across configurations.
  • Memory pressure — not at OOM; ~700 MB used of 1.9 GB. No OOM entries in dmesg/journal.
  • Edit payload in mode A is a straightforward ASCII text replacement in a .sh file, 626-char new_string, replace_all: false. Nothing unusual — no emoji, no regex specials, no huge size.
  • Disk state — project files fine, no I/O errors, the Edit never actually ran.

Request

  1. Is there telemetry / logging we can enable on the CLI to catch the handoff between model response and tool execution (mode A) and the handoff between tool_result and next model turn (mode B)?
  2. Is the 30x tool_use:end_turn ratio a known precursor to tool-execution hangs in v2.1.109 / Opus 4.7?
  3. Is there a way to surface the hang as an error (exit code, SIGTERM, or at least an error line in the JSONL) instead of silent freeze? Currently there's no signal from the CLI — the process stays running, the session stays "active," but no tool is executing and no assistant turn is advancing.

Happy to pull the full JSONLs and attach them to this issue if it helps. Both stuck sessions are preserved at:

  • /home/ubuntu/.claude/projects/-home-ubuntu-nolix/1a642596-ee80-4d9e-bf8a-eee474d4e82a.jsonl.stuck-20260419-edit1113
  • /home/ubuntu/.claude/projects/-home-ubuntu-nolix/fc891dc4-a248-4d22-949e-3b061660c307.jsonl.stuck-20260419

extent analysis

TL;DR

Enable telemetry/logging on the CLI to catch handoffs between model response and tool execution, and between tool_result and next model turn, to better understand the silent stuck-turn issue.

Guidance

  • Investigate the tool_use and end_turn stop ratios to understand why they are far outside the norm, which might indicate an issue with the model's tool execution or turn generation.
  • Check if there are any known issues or limitations in v2.1.109 / Opus 4.7 that could be causing the tool-execution hangs, especially with high tool_use:end_turn ratios.
  • Consider attaching the full JSONLs to the issue for further analysis, as they may provide valuable insights into the problem.
  • Look into enabling error logging or surfacing the hang as an error (exit code, SIGTERM, or error line in the JSONL) to get a clearer signal when the CLI freezes.

Example

No code snippet is provided as the issue does not require a code-level fix at this stage, but rather an investigation into the model's behavior and potential configuration or logging adjustments.

Notes

The provided information suggests that the issue is related to the model's tool execution and turn generation, but more data and logging are needed to pinpoint the exact cause. The tool_use:end_turn ratio and the lack of error signals when the CLI freezes are key areas to focus on.

Recommendation

Apply a workaround by enabling telemetry/logging on the CLI to gather more information about the handoffs between model response and tool execution, and between tool_result and next model turn. This will help identify the root cause of the issue and potentially lead to a more permanent fix.

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

claude-code - 💡(How to fix) Fix [Bug] v2.1.109 / Opus 4.7 — silent stuck-turn during tool execution (two distinct failure modes) [6 comments, 2 participants]