claude-code - 💡(How to fix) Fix [Bug] Claude silently ends turn on Edit tool failure instead of retrying or continuing plan [2 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#52241Fetched 2026-04-24 06:12:26
View on GitHub
Comments
2
Participants
2
Timeline
5
Reactions
0
Author
Timeline (top)
labeled ×3commented ×2

Error Message

[Critical / Blocking] Claude silently ends the turn when Edit tool returns "Error editing file" — no recovery, no follow-through on the remaining planned steps When the Edit tool fails with "Error editing file," Claude goes silent and ends the turn, even though it just announced a multi-step plan moments earlier. It does not 2. The first Edit call fails with "Error editing file" (e.g. old_string not unique, whitespace mismatch).

  • Blocks real work — user has to babysit every tool error.
  • Tool-error recovery should be default behavior, especially mid-plan.
  • Add an explicit system-prompt rule: "A tool error is a step to recover from, not a signal to end the turn."
  • Or: make the Edit tool's error message more actionable (state whether old_string was not unique / not found / whitespace-mismatched) so the model can retry
RAW_BUFFERClick to expand / collapse

Bug Description

[Critical / Blocking] Claude silently ends the turn when Edit tool returns "Error editing file" — no recovery, no follow-through on the remaining planned steps

Problem

When the Edit tool fails with "Error editing file," Claude goes silent and ends the turn, even though it just announced a multi-step plan moments earlier. It does not
retry, does not re-Read the file, does not proceed to the next step, and does t surface a specific blocker. The user has to re-prompt every single time.

Repro

  1. Ask Claude to do a multi-step task, e.g. "fix 2 spots in proxy.ts, then hand off to executor to wrap 35 files."
  2. The first Edit call fails with "Error editing file" (e.g. old_string not unique, whitespace mismatch).
  3. Actual: Claude ends the turn. The 35-file step is never attempted.
  4. Expected: Claude should re-Read the file, retry with larger context / replace_all / smaller chunks, and continue the announced plan. If genuinely blocked, it should ask a specific question — not go silent.

Impact

  • Blocks real work — user has to babysit every tool error.
  • Wastes a full round-trip and erodes trust in autonomous execution.
  • Reproduces across many sessions, not a one-off.

Suggested fix

  • Tool-error recovery should be default behavior, especially mid-plan.
  • Add an explicit system-prompt rule: "A tool error is a step to recover from, not a signal to end the turn."
  • Or: make the Edit tool's error message more actionable (state whether old_string was not unique / not found / whitespace-mismatched) so the model can retry accurately.

Environment

  • Claude Code, Opus 4.7 (1M context)
  • Occurred during a multi-file refactor in a Next.js / TypeScript project.

extent analysis

TL;DR

Implement tool-error recovery as default behavior, especially mid-plan, to prevent Claude from ending the turn silently when the Edit tool returns an "Error editing file" message.

Guidance

  • Review the Edit tool's error handling to determine why it's causing Claude to end the turn prematurely.
  • Consider adding an explicit system-prompt rule to treat tool errors as recoverable steps rather than turn-end signals.
  • Enhance the Edit tool's error message to provide more actionable information, such as specifying whether the old_string was not unique, not found, or had a whitespace mismatch, to enable more accurate retries.
  • Investigate the feasibility of implementing a retry mechanism with adjustable context, replace_all, or chunk sizes to handle failed Edit calls.

Example

No code snippet is provided as the issue does not contain sufficient technical details to generate a specific example.

Notes

The suggested fix implies that the current behavior is not configurable, and a code change might be necessary to implement the desired recovery mechanism. The issue's reproducibility across sessions suggests a systemic problem rather than an isolated incident.

Recommendation

Apply a workaround by modifying the Edit tool's error handling to provide more informative error messages, allowing for more targeted retries, until a more comprehensive tool-error recovery mechanism can be implemented.

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] Claude silently ends turn on Edit tool failure instead of retrying or continuing plan [2 comments, 2 participants]