[BUG] Claude's diff editor in VSCode silently discarded my edits to the file

Resolved 💬 3 comments Opened Jun 9, 2026 by josh-berry Closed Jul 16, 2026

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?

I was working on a file with Claude in VSCode, using the official Claude Code VSCode plugin. I asked it to draft the first version of the file (a Markdown document), and then I spent a few hours afterwards editing the file without interacting with Claude at all.

During my chat session, Claude popped open its diff window to show me some proposed changes, which I tweaked slightly and approved. (This will be important later.)

After I finished with Claude, I continued manually. I saved my changes frequently, did a git add and git commit, and to my dismay discovered much later that only the first draft of the file, produced by Claude, was actually written to disk. So my hours of work had never been saved or committed and were completely lost.

What Should Happen?

When I hit Cmd+S in VSCode, I expect it to write the file to disk, or throw up an error indicating that it's not possible to do so, and explain why. (e.g. "Hey, [expletive], you're editing this file in Claude's diff editor and not the actual file buffer. You can't save files from here.")

Error Messages/Logs

None.

Steps to Reproduce

  1. Ask Claude to edit a file for you.
  2. Tweak the edits it proposes.
  3. Approve the edits.
  4. Note Claude's diff editor remains open, but all diffs are resolved.
  5. Make some more edits and save your changes. (Note: We're still in Claude's diff preview, not the built-in file editor.)
  6. Note that no error is presented—the save appears to succeed.
  7. Check the content of the file on disk, and observe that your changes were NOT saved.

Claude Model

Sonnet (default)

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.153 (Claude Code)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

VS Code integrated terminal

Additional Information

This issue seemed to occur because, unbeknownst to me, I was still editing the file in Claude's diff preview mode instead of editing the actual file in the built-in VSCode file editor. But there was no visible indication of this fact, until I quit and later relaunched VSCode, and it showed me a blank Claude tab and an error message where my file content was supposed to be.

Worse, when I saved the file, there was no indication that the save had failed, so I had no way of knowing anything was wrong. Please update the Claude diff editor/preview tab to either actually save the file as requested, or show an error if the Save command is triggered.

As a result of this bug, I have lost a half-day's work that I may not be able to reproduce and this has made a significant impact on my timelines/deliverables on a tight project.

View original on GitHub ↗

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