Skip to content

fix: handle EEXIST in mkdir for OneDrive-synced .git/info on Windows#809

Open
0xSkybreaker wants to merge 1 commit into
XiaomiMiMo:mainfrom
0xSkybreaker:fix/issue-721-windows-eexist-onedrive
Open

fix: handle EEXIST in mkdir for OneDrive-synced .git/info on Windows#809
0xSkybreaker wants to merge 1 commit into
XiaomiMiMo:mainfrom
0xSkybreaker:fix/issue-721-windows-eexist-onedrive

Conversation

@0xSkybreaker

Copy link
Copy Markdown

@

Summary

Fixes #721 — MiMo Code crashes on startup in OneDrive-synced Git repositories on Windows because mkdir(".git/info", { recursive: true }) throws EEXIST when the directory has the ReadOnly NTFS attribute.

Root Cause

This is a known libuv/Node.js issue (nodejs#43994): on Windows, mkdir with { recursive: true } throws EEXIST when the target directory already exists and has the ReadOnly attribute. OneDrive sets this attribute on synced folders by default.

Changes

packages/opencode/src/project/project.ts — Catch and suppress EEXIST in setupProjectIdEnvironment when creating .git/info:

await nodeFs
  .mkdir(nodePath.dirname(excludeFile), { recursive: true })
  .catch((e: any) => {
    if (e?.code !== "EEXIST") throw e
  })

Impact

Before this fix, MiMo Code was completely unusable on Windows with OneDrive-synced projects — it crashed before the TUI loaded. This affects a large portion of Windows users since OneDrive is the default sync for Documents/Desktop on Windows 10/11.

Reproduction (before fix)

attrib +R ".git\info"
mimo  # crashes with EEXIST: file already exists, mkdir .gitinfo

🤖 Generated with Claude Code@

@
fix: handle EEXIST in mkdir for OneDrive-synced .git/info on Windows

On Windows, mkdir with {recursive: true} throws EEXIST when the
target directory has the ReadOnly NTFS attribute (commonly set
by OneDrive on synced folders). This is a known libuv/Node.js
issue (nodejs#43994).

Catch and suppress EEXIST in setupProjectIdEnvironment so MiMo
Code can start in OneDrive-synced Git repositories.

Closes: XiaomiMiMo#721
@
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

EEXIST: file already exists, mkdir '.git/info' on Windows with OneDrive-synced projects

1 participant