[BUG] Write/Edit tools hang indefinitely when target file is deleted from disk while open in VS Code

Open 💬 0 comments Opened Jun 25, 2026 by MrRousek

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

Title: Write/Edit tools hang indefinitely when target file is deleted from disk while open in VS Code

---

Environment

  • Claude Code: VSCode Extension
  • OS: Windows 10
  • Model: claude-sonnet-4-6

Steps to Reproduce

  1. Open a file in VS Code (file exists on disk)
  2. Delete the file from disk without closing the VS Code tab
  3. Ask Claude Code to edit or write to that file
  4. Observe Claude Code hanging with no response

Expected Behavior
Write/Edit tool returns a clear FileNotFoundException error immediately. Claude reports to the user that the file no longer exists on disk.

Actual Behavior

  • ide_opened_file context in the system prompt still shows the file as open — Claude assumes the file exists
  • First Read call succeeds from cache (returns content without hitting disk)
  • Subsequent Read returns "Wasted call — file unchanged since your last Read" — cache hit again, disk not checked
  • Write/Edit call hangs indefinitely with no timeout and no error message
  • User sees Claude silent for several minutes with no indication of what is wrong

Root Cause (two separate defects)

  1. Read tool does not invalidate its cache when the underlying file is deleted from disk — stale cache gives false confidence the file exists
  2. Write/Edit tool has no timeout and does not surface a file-not-found error — it simply hangs

Workaround
Close the file tab in VS Code before deleting it from disk, or ask Claude to write to a different path.

What Should Happen?

-

Error Messages/Logs

-

Steps to Reproduce

-

Claude Model

Sonnet (default)

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

last

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

VS Code integrated terminal

Additional Information

_No response_

View original on GitHub ↗