String to replace not found in file. & Error calling tool

Status Fixed / completed
Maintainer reply ✓ Yes — bcherny
Activity 12 comments · opened Feb 27, 2025 · closed May 7, 2025
💡 Likely answer: A maintainer (bcherny, collaborator) responded on this thread — see the highlighted reply below.

About 80% of all actions it tried to take failed
Left it for 15 minutes and and it went down a rabbit hole of failure
20ffad30-bad6-4040-8e4f-fa2ced703cae

View original on GitHub ↗

12 Comments

ChristopheGouetPracticIO · 1 year ago

Same here.
It was working like a charm on the same code repository yesterday and today I fall in a lot of:

● Update(file_path: .vscode/tasks.json)…  
  ⎿  String to replace not found in file.  

● It seems there is an issue with directly editing the file. Here’s what I recommend doing manually:  
  1. Open the file `.vscode/tasks.json` in your editor.  
  2. Find the "InternalAPI" section (around lines 38-44).
slinaresperalta · 1 year ago

!Image

same thing happening here.

SO: Windows WSL with Ubuntu
I'm CDing to a folder inside windows mounted and running it there

forensicmike · 1 year ago

same thing here. it worked perfectly well the first day i tried it. ever since, its failed every time. could it have something to do with windows style newlines? unfortunately its unuseable for me in this current state (and VERY expensive)

adv-algos · 1 year ago

Yes, this is happening way to often now. Maybe something in the update tool changed recently.

SamKr · 1 year ago

+1

Having a lot of fun with Claude Code, however the amount of 'String to replace not found in file' errors are a bummer. Would be great if it could get tackled, or a workaround would be good as well since this is still a research project.

coreyshum · 1 year ago

Same here. On Mac, it can't seem to update files and ends up running in circles trying to create bash scripts to do the same thing, wasting time and credits.

adv-algos · 1 year ago

I just added the mcp mcp-text-editor from here, and claude code is working better. When it get's frustrated with it's default writer, it jumps over to this one for a while. I just wish I could toggle the built in mcp tools.
With uvx installed, you can add with:
claude mcp add mcp-text-editor uvx mcp-text-editor

SamKr · 1 year ago

Interesting find @adv-algos. I saw this in the update notes:

!Image

Maybe you could write a simple prompt:

``For the rest of this session, always use mcp-text-editor when working with local files. Other methods are prone to errors, since the source is located on a Windows system with CRLF line endings instead of Linux' LF line endings.``

Save it as /home/claudecode/.claude/commands/enableeditor.md or something, and execute it whenever you start a session? Just an idea.

bcherny collaborator · 1 year ago

This should be feeling better with newer versions of Claude Code. claude update or restart to update, and please open a new issue if you're still hitting this.

adamtaylor13 · 1 year ago

I only started getting these errors today. Same repository has been working fine for the past few weeks, but suddenly today it has fits where it can't seem to get a read on files. If I end the entire session and restart it'll usually do its "startup" reading correctly with no issues when I first hand it a task. However, after about 3-5 minutes it'll try to make some suggested updates and struggle to read files that it's already successfully read before. Very strange.

igorkofman collaborator · 1 year ago

We've made further improvements here. Please let us know if feeling better with today's release

github-actions[bot] · 1 year ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.