From 9dbf3375ae8f17351bfef829ea7beb848ceb6fc7 Mon Sep 17 00:00:00 2001 From: fjia Date: Tue, 16 Jun 2026 10:26:07 +0800 Subject: [PATCH] @ 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: #721 @ --- packages/opencode/src/project/project.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/opencode/src/project/project.ts b/packages/opencode/src/project/project.ts index 96212ace..e726ba8b 100644 --- a/packages/opencode/src/project/project.ts +++ b/packages/opencode/src/project/project.ts @@ -44,7 +44,13 @@ async function setupProjectIdEnvironment(workingDir: string): Promise { // Belt-and-suspenders: ensure .git/info/exclude lists .mimocode-project-id const excludeFile = nodePath.join(mainGit, "info", "exclude") - await nodeFs.mkdir(nodePath.dirname(excludeFile), { recursive: true }) + await nodeFs + .mkdir(nodePath.dirname(excludeFile), { recursive: true }) + .catch((e: any) => { + // Windows: EEXIST is thrown when the directory has the ReadOnly + // attribute (e.g. OneDrive-synced folders). nodejs#43994. + if (e?.code !== "EEXIST") throw e + }) const existing = await nodeFs.readFile(excludeFile, "utf-8").catch(() => "") if (!existing.includes(".mimocode-project-id")) { await nodeFs.appendFile(excludeFile, "\n.mimocode-project-id\n")