[BUG] Error: String not found in file. Failed to apply edit.

Resolved 💬 4 comments Opened Jul 23, 2025 by maharjun Closed Aug 19, 2025

Environment

  • Platform (select one):
  • [x] Anthropic API
  • [ ] AWS Bedrock
  • [ ] Google Vertex AI
  • [ ] Other: <!-- specify -->
  • Claude CLI version: 1.0.59 (Claude Code)
  • Operating System: Windows 11 WSL, Ubuntu 24
  • Terminal: Terminal App

Bug Description

Uncaught exception error

Steps to Reproduce

No clue, happened randomly when it was trying to edit a file.

Expected Behavior

That it should not crash.

Actual Behavior

That it crashes with the following uncaught exception.

node:internal/process/promises:394
triggerUncaughtException(err, true / fromPromise /);
^

Error: String not found in file. Failed to apply edit.
at gk (file:///home/arjun/micromamba/envs/cosmon-env/lib/node_modules/@anthropic-ai/claude-code/cli.js:1766:728)
at K78 (file:///home/arjun/micromamba/envs/cosmon-env/lib/node_modules/@anthropic-ai/claude-code/cli.js:2741:10940)
at J (file:///home/arjun/micromamba/envs/cosmon-env/lib/node_modules/@anthropic-ai/claude-code/cli.js:2741:9918)
at file:///home/arjun/micromamba/envs/cosmon-env/lib/node_modules/@anthropic-ai/claude-code/cli.js:2741:10184
at bI (file:///home/arjun/micromamba/envs/cosmon-env/lib/node_modules/@anthropic-ai/claude-code/cli.js:67:21377)
at wJ (file:///home/arjun/micromamba/envs/cosmon-env/lib/node_modules/@anthropic-ai/claude-code/cli.js:67:40875)
at file:///home/arjun/micromamba/envs/cosmon-env/lib/node_modules/@anthropic-ai/claude-code/cli.js:67:39071
at ju1 (file:///home/arjun/micromamba/envs/cosmon-env/lib/node_modules/@anthropic-ai/claude-code/cli.js:61:78952)
at Immediate.Lu1 [as _onImmediate] (file:///home/arjun/micromamba/envs/cosmon-env/lib/node_modules/@anthropic-ai/claude-code/cli.js:61:79371)
at process.processImmediate (node:internal/timers:505:21)

Node.js v24.4.1

Additional Context

It was attempting to make a change in a file which it just failed at.

View original on GitHub ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗