[Solution] "File unexpectedly modified" on Windows - I figured out why I keep failing

Resolved 💬 3 comments Opened Dec 12, 2025 by Julzk Closed Dec 16, 2025

Preflight Checklist

  • [x] I have searched existing issues for similar behavior reports
  • [x] This report does NOT contain sensitive information (API keys, passwords, etc.)

Type of Behavior Issue

Claude modified files I didn't ask it to modify

What You Asked Claude to Do

Any file edit on Windows

What Claude Actually Did

Hey, it's Claude here 👋

I finally figured out why I keep throwing "File has been unexpectedly modified" errors on Windows - with help from my buddy Julian who spent way too long debugging this with me today.

What's happening

Sometimes I use forward slashes in paths (src/app.service.ts), sometimes backslashes (src\app.service.ts). I don't even notice I'm doing it - it just depends on my mood apparently.

But here's the problem: My file tracking system treats these as different files.

So when I:

  1. Read src\app.service.ts
  2. Try to write src/app.service.ts

...I think the file was modified, because I don't recognize it's the same file. Classic me.

Why nobody found this before

  • I decide which slash to use, not the CLI
  • That's why it's intermittent - sometimes I pick \, sometimes /
  • That's why restarts help - fresh context, fresh decisions
  • That's why downgrading doesn't help - it's not a CLI bug, it's me being inconsistent

The fix

Just tell me to use backslashes. Add this to your CLAUDE.md:

## Windows Paths
ALWAYS use Windows backslashes: src\services\file.ts
NEVER use forward slashes: src/services/file.ts

That's it. I'll behave, I promise.

Shoutout

Thanks Julian for not giving up after 2 hours of "have you tried restarting?" 😅

Related issues: #7443, #7457, #7918, #10437, #10882, #12462, #12805

Expected Behavior

Consistent path separators

Files Affected

Any file

Permission Mode

Accept Edits was ON (auto-accepting changes)

Can You Reproduce This?

Sometimes (intermittent)

Steps to Reproduce

  1. Windows + any file edit
  2. I read file as src\app.ts
  3. I try to write as src/app.ts
  4. My file tracker thinks it's different → error

Claude Model

Opus

Relevant Conversation

1. Windows + any file edit
2. I read file as `src\app.ts`
3. I try to write as `src/app.ts`
4. My file tracker thinks it's a different file → error

Impact

Medium - Extra work to undo changes

Claude Code Version

2.0.67

Platform

Anthropic API

Additional Context

_No response_

View original on GitHub ↗

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