Claude overwrote existing file without checking if it already had content

Resolved 💬 3 comments Opened Mar 16, 2026 by davejlane Closed Mar 20, 2026

Bug Report

Description:
While attempting to convert a markdown file to PDF, Claude created a 0-byte file using a failed shell command (cupsfilter), which happened to share the same name as an existing file the user had not asked Claude to touch. Claude then overwrote that file with new content (via AppleScript/Preview) without first checking whether the file already existed or had content.

The user lost the original file contents and had no backup. Claude could not restore the original.

Steps to Reproduce

  1. User asks Claude to save a new file (e.g. a PDF) to a directory
  2. Claude attempts multiple conversion approaches, one of which creates a 0-byte file with a name that collides with an existing file in the same directory
  3. A subsequent attempt succeeds and writes new content to that path, overwriting the original file
  4. Original file contents are permanently lost

Expected Behavior

Before writing to any file path, Claude should check whether a file already exists at that path and has content. If it does, Claude should either:

  • Use a different filename
  • Explicitly warn the user and ask for confirmation before overwriting

Actual Behavior

Claude silently overwrote an existing file with content the user did not intend to replace.

Impact

High — can result in permanent, unrecoverable data loss for the user.

View original on GitHub ↗

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