claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

[BUG] Claude erases contents of PHP files using Edit / Multi-edit tools

Open sparkbugz opened this issue 7 months ago • 0 comments

Environment

  • Platform (select one):
    • [X] Other: Claude Code v1
  • Claude CLI version: 1.0.3
  • Operating System: Ubuntu 22.04

Bug Description

When tasked with removing a large amount of specific lines of data, Claude decides to use the multi edit tools and it appears that sometimes Claude will delete the entire contents of multiple files entirely

Steps to Reproduce

This appears to be a behavior I find somewhat easier to reproduce by accident than

Expected Behavior

Requested Claude remove a lot of $logger calls in a specific subset of folders within a php based script. It should have simply removed those lines in all affected files.

Actual Behavior

Result was a seemingly random assortment of files being entirely purged of all data. Their sizes ended up being 0 bytes, with the only way to restore being of course backups.

Additional Context

It appears that asking Claude to systematically remove a large amount (maybe 42 different lines with minor variances) of repetitive lines of code causes the LLM to resort to the tools that allow it to edit multiple files at once, but it seems to malfunction in some way that it causes entire files to be 0'd out entirely. I did submit a /bug within the terminal itself for this, but I also wanted to put in a github issue. It is a pretty alarming issue, especially if you don't know which files got somehow until you come across it. This has happened happened several times at this point. It even 0'd some files that were not even related.

sparkbugz avatar May 23 '25 13:05 sparkbugz