Skip to content

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

Closed as duplicate

Description

@Julzk

Preflight Checklist

  • I have searched existing issues for similar behavior reports
  • 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

Activity

  1. github-actions commented on Dec 12, 2025

    @github-actions

    Found 3 possible duplicate issues:

    1. Edit tool returns "File has been unexpectedly modified" when file is NOT modified #12462
    2. [BUG] Edit Tool False Positive "File has been unexpectedly modified" on Windows #12695
    3. Edit/Write tools fail with 'File has been unexpectedly modified' after Read tool #10437

    This issue will be automatically closed as a duplicate in 3 days.

    • If your issue is a duplicate, please close it and 👍 the existing issue instead
    • To prevent auto-closure, add a comment or 👎 this comment

    🤖 Generated with Claude Code

  2. added
    duplicateThis issue or pull request already exists
    and removed
    bugSomething isn't working
    has reproHas detailed reproduction steps
    platform:windowsIssue specifically occurs on Windows
    on Dec 16, 2025
  3. github-actions commented on Dec 16, 2025

    @github-actions

    This issue has been automatically closed as a duplicate of #12462.

    If this is incorrect, please re-open this issue or create a new one.

    🤖 Generated with Claude Code

  4. github-actions commented on Dec 23, 2025

    @github-actions

    This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.

  5. locked as resolved and limited conversation to collaborators on Dec 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateThis issue or pull request already exists

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions