Edit tool fails with EEXIST: file already exists, mkdir on OneDrive-synced paths

Resolved 💬 3 comments Opened Mar 12, 2026 by caldwellcourtneyc Closed Mar 12, 2026

Environment: Claude Code 2.1.71, Windows 11 Pro, files in OneDrive-synced directory

What happens: Every Edit tool call fails with:

EEXIST: file already exists, mkdir 'C:\Users\...\OneDrive\...'

The Edit tool's internal mkdir for parent directories fails because the directory already exists. Read and Write tools work fine on the same paths — only Edit is affected.

Reproduction:

  1. Have a project in a OneDrive-synced folder on Windows
  2. Read any file (succeeds)
  3. Attempt Edit on that file (fails with EEXIST)
  4. Write to the same file (succeeds)

Workarounds: Using Bash with sed/node scripts, or Write tool to overwrite entire files.

Notes: Happens on every Edit attempt, not intermittent. Likely the mkdir call needs a recursive: true flag or an existence check before creating parent directories. OneDrive's filesystem layer may be reporting directory existence differently than expected.

View original on GitHub ↗

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