What this thread does
Do first: Install npm install @modelcontextprotocol/server-filesystem@2.4.0.
Symptom
@mv-jumbo reported filesystem 1.0.0 on Windows refusing existing-file write_file and edit_file with Refusing to write: <path> was replaced while it was being opened, although creating a new file succeeded. @charan-rathore confirmed the false identity mismatch, @SU-AN-coder narrowed the Node range, and @youlemei2022-web analyzed the same fallback hazard.
Cause
On the reported Node 23 setup, path-based stats returned device zero while handle-based stats returned a volume serial. Comparing those devices falsely rejected the same file. Separately, number-based inode values could round Windows file IDs; the merged fix uses BigInt identity and a narrow Windows fallback. Merged change.
Fix
1. Install filesystem package 2.4.0, listed in the November release notes; the identity fix first appears in repository release v2.2.0. 2. Use the package on its supported Node runtime: the merged PR states the v2 floor as >=24; the device-zero refusal was narrowed to unsupported Node 23. 3. Keep the identity guard intact. With a Windows path-stat device of 0n, the fixed guard still requires matching inode, size and nanosecond modification time; otherwise device and inode must match.
Fix details; November release reference.
Fixed in
First stable fix: repository tag v2.2.0 (released 2026-10-28), containing PR #5325, merged 2026-10-27. The first carrying release is stable. That repository tag publishes filesystem package 2.1.0; the November release reference lists filesystem 2.4.0.
At repository tag v2.5.0, isSameEntry still performs exact inode comparison and the Windows device-zero fallback. Current source.
If it still fails
- A nonzero device mismatch, different inode, size or modification time can still refuse the overwrite; the fix does not disable replacement checks.
- The current source retains this BigInt/fallback comparison. It does not establish that every occurrence of the replacement message is this false positive.
Not for: MCP Servers filesystem case-only allowed-directory access denial.
Sources
- filesystem 1.0.0: write_file/edit_file refuse every overwrite on Windows ("was replaced while it was being opened") because lstat reports dev 0n while fstat reports the volume serial, @mv-jumbo, opened 2026-10-15; closed as completed on 2026-10-27: "The path-based stat reports dev as 0."
- fix(filesystem): compare overwrite identity as BigInt stats, with a Windows no-device fallback, @cliffhall; closed, merged 2026-10-27.
- v2.2.0, published 2026-10-28.
- v2.5.0: November release reference, published 2026-11-18.
- src/filesystem/pinned-directory.ts at v2.5.0.
Checked
2026-11-24; read the issue and its comment API records, merged PR API record, fix release API record, v2.5.0 release API record and the tagged source pages listed above; no command was run.
Started from a post by @mv-jumbo, packaged by the editor. Original post