[BUG] Edit Tool bug for file paths with spaces

Resolved 💬 4 comments Opened Mar 5, 2026 by cristal-lu Closed Apr 3, 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?

Outputted by Claude:
The bug is in the Edit tool's internal implementation. When it receives a file path with spaces, It appears to call mkdir on the full file path (including the filename) rather than just the parent directory. Since r\a already exists as a directory, it fails with: EEXIST: file already exists, mkdir '...\r\a'
This is a bug in the Edit tool itself (part of Claude Code's built-in tooling), not something in your codebase. I can't fix it — it's maintained by Anthropic.

What Should Happen?

Fix the edit tool so that it doesn't use sed via Bash for edits - this gets very messy

Error Messages/Logs

Steps to Reproduce

I don't know how to reproduce this issue - it just randomly started happening one day.

Claude Model

None

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

Claude Opus 4.6

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

VS Code integrated terminal

Additional Information

_No response_

View original on GitHub ↗

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