Kimi Code Extension: UNC .git Bug — Diagnosis & Patch Guide
Recorded 2026-08-02 (Windows 11 ARM64, Acer) while fixing this on a Windows machine.
Written to be reusable on other machines — read the "Notes for macOS" section first if you are on a Mac.
Symptom
- Kimi Code extension (VS Code / Antigravity) works in exactly one project (
NintendoBot) and fails everywhere else.
- In every other window: typing a message and pressing send does nothing — the text stays in the input box, no visible error on screen.
- Uninstalling / reinstalling the extension does not help (it is a code bug, not corrupted state).
How to diagnose (repeatable on any machine)
-
In a broken window, try to send one message.
-
Open the Command Palette (Ctrl+Shift+P / macOS Cmd+Shift+P) → run Kimi Code: Show Logs.
-
If you see this line repeated on every send attempt, it is this exact bug:
Chat preflight request failed: KimiError: UNKNOWN: unknown error, stat '\\ds923\.git\'
(The path differs per machine — it is <server>\.git of whatever file server the workspace lives on.)
Root cause
- On send, the extension creates a session → loads the MCP config → calls
findProjectRoot(cwd), which walks up parent directories probing for .git (git root detection).
- If the workspace is on a NAS via a UNC path, e.g.
\\ds923\SomeShare\Folder, and has no .git, the walk climbs past the share root and stats \\ds923\.git\ — i.e. it asks server ds923 for a share literally named .git, which does not exist.
- Node/libuv on Windows reports this with error code
UNKNOWN (not the usual ENOENT).
pathExists$2 in dist/extension.js only swallows ENOENT/ENOTDIR; every other error is rethrown → preflight fails → the message is never sent.
NintendoBot survived because it is a git repo — .git is found at the first level and the walk never reaches the UNC share root.
Reproduce with plain Node (proves it is not machine-specific)
// test_unc_stat.js — run with: node test_unc_stat.js
const fs = require('fs');
try {
fs.statSync('\\\\ds923\\.git\\');
console.log('OK');
} catch (e) {
console.log('FAIL ->', e.code, '|', e.message);
// Windows: FAIL -> UNKNOWN | UNKNOWN: unknown error, stat '\\ds923\.git\'
}
The patch (applied 2026-08-02 on the Windows machine)
One line in the extension's dist/extension.js:
async function pathExists$2(filePath) {
try {
await stat$2(filePath);
return true;
} catch (error) {
if (isPathMissing$1(error)) return false;
- throw error;
+ return false;
}
}
Location in version 0.6.7: region header //#region ../../packages/agent-core/src/mcp/config-loader.ts
(around byte offset 5497726 — search for pathExists$2 or isPathMissing).
Steps
# 1. Go to the extension folder (Windows example)
cd "/c/Users/<user>/.vscode/extensions/moonshot-ai.kimi-code-<version>/dist"
# 2. Back up the original file
cp extension.js extension.js.bak-unc-fix
# 3. Edit: find "if(isPathMissing$1(error))return false;throw error"
# and change "throw error" to "return false" (inside pathExists$2 only).
# ⚠️ Minified variable names may differ across versions — search by context:
# "pathExists" + "isPathMissing" + "throw error" close together.
# 4. Syntax check (important: the bundle is ESM — you need --input-type=module)
node --check --input-type=module < extension.js && echo SYNTAX_OK
# 5. Reload every IDE window (Developer: Reload Window) or restart the app
Repeat for every IDE that has its own copy of the extension
Each IDE keeps a separate copy (same version = byte-identical file, so you can copy the already-patched file over — back up first):
| IDE |
Windows |
macOS |
| VS Code |
%USERPROFILE%\.vscode\extensions\moonshot-ai.kimi-code-* |
~/.vscode/extensions/moonshot-ai.kimi-code-* |
| Antigravity |
%USERPROFILE%\.antigravity-ide\extensions\moonshot-ai.kimi-code-* |
~/.antigravity-ide/extensions/moonshot-ai.kimi-code-* |
# Example: copy the patched file over Antigravity's copy (after md5sum confirms the originals match)
cp <antigravity>/dist/extension.js <antigravity>/dist/extension.js.bak-unc-fix
cp <vscode>/dist/extension.js <antigravity>/dist/extension.js
node --check --input-type=module < <antigravity>/dist/extension.js && echo SYNTAX_OK
Notes for macOS
- This bug may not occur on macOS at all — macOS mounts network shares under
/Volumes/<share>, a normal POSIX path. The .git walk terminates at /, and stat returns plain ENOENT, which the code already handles. No UNKNOWN error.
- So test first, don't patch blindly: open a non-git project stored on the NAS and try sending a message.
- Works fine → nothing to do.
- Same symptom → check the log (
Kimi Code: Show Logs) for the same error, then apply the patch steps above.
- You can probe with the Node script above using the real mount path, e.g.
/Volumes/.git.
- The macOS extension build is
darwin-arm64 / darwin-x64; the bundle structure is the same. Search with: grep -ao '.\{80\}pathExists\$2.\{80\}' extension.js
Rollback
cd <extension>/dist
cp extension.js.bak-unc-fix extension.js
# then reload the window
Caveats
- The patch is overwritten when the extension auto-updates. If the symptom returns after an update, the new version still has the bug — re-apply this patch.
- The truly permanent fix is upstream: report the bug (drafts below) to Moonshot.
- The bundle contains a second copy of the same pattern (
pathExists$1 in agent-core-v2, around byte 7462143) that also rethrows. It was not patched (minimal-change principle — it is not the code path that caused this symptom). If a similar error with a different message ever appears, revisit that one.
Draft: Bug report email to Moonshot (code@moonshot.ai)
To: code@moonshot.ai
Subject: Bug: VS Code extension 0.6.7 — chat fails on UNC (network share) workspaces: stat '\\server\.git\' throws UNKNOWN
Hi Kimi Code team,
Found a bug in the VS Code extension (moonshot-ai.kimi-code 0.6.7, win32-arm64)
that makes chat completely unusable for any workspace opened via a UNC path
(Windows network share, e.g. a NAS) that is not a git repository.
## Symptom
Typing a message and pressing send does nothing — the text stays in the input
box. The log ("Kimi Code: Show Logs") shows, on every send attempt:
Chat preflight request failed: KimiError: UNKNOWN: unknown error, stat '\\ds923\.git\'
Reinstalling the extension does not help.
## Root cause
During chat preflight, session creation loads the MCP config
(packages/agent-core/src/mcp/config-loader.ts), which calls findProjectRoot(cwd).
That function walks up parent directories probing for ".git" using pathExists():
async function pathExists(filePath) {
try {
await stat(filePath);
return true;
} catch (error) {
if (isPathMissing(error)) return false; // only ENOENT/ENOTDIR
throw error; // <-- everything else escapes
}
}
For a workspace at \\ds923\SomeShare\Folder (server "ds923", share "SomeShare"),
the walk climbs past the share root and stats \\ds923\.git\ — i.e. it asks the
server for a share literally named ".git". On Windows, Node/libuv surfaces this
as a SystemError with code UNKNOWN (UV_UNKNOWN), not ENOENT, so pathExists
rethrows and the whole preflight fails.
A workspace that IS a git repo works fine, because .git is found at the first
level and the walk never reaches the UNC share root.
## Minimal reproduction (plain Node on Windows, no extension involved)
const fs = require('fs');
try {
fs.statSync('\\\\ds923\\.git\\');
} catch (e) {
console.log(e.code, '|', e.message);
// -> UNKNOWN | UNKNOWN: unknown error, stat '\\ds923\.git\'
}
(Any Windows machine with a SMB share; replace ds923 with the server name.)
## Suggested fix
pathExists() should treat ANY stat failure as "not found" (return false),
not just ENOENT/ENOTDIR — a probe for an optional marker file should never
throw. Alternatively, findProjectRoot() should stop the upward walk at the
UNC share root.
Note: a second copy of the same pattern exists in the agent-core-v2 code path
(another pathExists that rethrows non-missing errors) — likely worth fixing
both.
## Workaround applied locally
I patched dist/extension.js (changed `throw error` to `return false` in that
one function) and chat now works in all UNC workspaces. Happy to provide more
logs if useful.
Environment: Windows 11 ARM64, VS Code + Antigravity, extension 0.6.7,
workspace on Synology NAS via SMB (\\ds923\...).
Thanks!
Keep this file after sending — if they reply asking for more logs, everything is in here.
Draft: GitHub Issue (recommended — use this one)
Open: https://github.com/MoonshotAI/kimi-code/issues/new
Title: Chat preflight fails on UNC (network share) workspaces: stat '\\server\.git\' throws UNKNOWN (Windows)
Body: copy only the part inside the fence below
## Bug description
On Windows, the VS Code extension (moonshot-ai.kimi-code 0.6.7, win32-arm64)
cannot send any chat message when the workspace is opened via a **UNC path**
(network share, e.g. a NAS) **and is not a git repository**. Typing a message
and pressing send does nothing — the text stays in the input box.
Workspaces that are git repositories work fine, which made this look
environment-specific at first. Reinstalling the extension does not help.
## Log output
`Kimi Code: Show Logs` shows this on **every** send attempt:
```
Chat preflight request failed: KimiError: UNKNOWN: unknown error, stat '\\ds923\.git\'
```
## Root cause
During chat preflight, session creation loads the MCP config
(`packages/agent-core/src/mcp/config-loader.ts`) → `findProjectRoot(cwd)` walks
up parent directories probing for `.git` via `pathExists()`:
```js
async function pathExists(filePath) {
try {
await stat(filePath);
return true;
} catch (error) {
if (isPathMissing(error)) return false; // only ENOENT/ENOTDIR
throw error; // ← everything else escapes
}
}
```
For a workspace at `\\ds923\SomeShare\Folder` (server `ds923`, share
`SomeShare`), the walk climbs **past the share root** and stats
`\\ds923\.git\` — i.e. it asks the server for a share literally named `.git`.
On Windows, Node/libuv surfaces this as a `SystemError` with code **UNKNOWN**
(`UV_UNKNOWN`), not `ENOENT`. `pathExists` rethrows it, preflight fails, and
the message is never sent.
A git-repo workspace survives because `.git` is found at the first level and
the walk never reaches the UNC share root.
## Minimal reproduction (plain Node, no extension involved)
Any Windows machine with an SMB share (replace `ds923` with the server name):
```js
const fs = require('fs');
try {
fs.statSync('\\\\ds923\\.git\\');
} catch (e) {
console.log(e.code, '|', e.message);
// → UNKNOWN | UNKNOWN: unknown error, stat '\\ds923\.git\'
}
```
## Expected behavior
`pathExists()` treats **any** stat failure as "not found" (a probe for an
optional marker file should never throw), and/or `findProjectRoot()` stops
the upward walk at the UNC share root.
## Suggested fix
```diff
} catch (error) {
if (isPathMissing(error)) return false;
- throw error;
+ return false;
}
```
Note: a second copy of the same pattern exists in the agent-core-v2 code path
(another `pathExists` that rethrows non-missing errors) — worth fixing both.
## Environment
- OS: Windows 11 ARM64
- Extension: moonshot-ai.kimi-code 0.6.7 (win32-arm64) — also reproduced in Antigravity
- Workspace: Synology NAS via SMB (`\\ds923\...`)
## Local workaround (confirmed working)
Patching `dist/extension.js` with the one-line change above fixes chat in all
UNC workspaces; behavior in normal (git) workspaces is unchanged.
Kimi Code Extension: UNC
.gitBug — Diagnosis & Patch GuideSymptom
NintendoBot) and fails everywhere else.How to diagnose (repeatable on any machine)
In a broken window, try to send one message.
Open the Command Palette (
Ctrl+Shift+P/ macOSCmd+Shift+P) → runKimi Code: Show Logs.If you see this line repeated on every send attempt, it is this exact bug:
(The path differs per machine — it is
<server>\.gitof whatever file server the workspace lives on.)Root cause
findProjectRoot(cwd), which walks up parent directories probing for.git(git root detection).\\ds923\SomeShare\Folder, and has no.git, the walk climbs past the share root and stats\\ds923\.git\— i.e. it asks serverds923for a share literally named.git, which does not exist.UNKNOWN(not the usualENOENT).pathExists$2indist/extension.jsonly swallowsENOENT/ENOTDIR; every other error is rethrown → preflight fails → the message is never sent.NintendoBotsurvived because it is a git repo —.gitis found at the first level and the walk never reaches the UNC share root.Reproduce with plain Node (proves it is not machine-specific)
The patch (applied 2026-08-02 on the Windows machine)
One line in the extension's
dist/extension.js:async function pathExists$2(filePath) { try { await stat$2(filePath); return true; } catch (error) { if (isPathMissing$1(error)) return false; - throw error; + return false; } }Location in version 0.6.7: region header
//#region ../../packages/agent-core/src/mcp/config-loader.ts(around byte offset 5497726 — search for
pathExists$2orisPathMissing).Steps
Repeat for every IDE that has its own copy of the extension
Each IDE keeps a separate copy (same version = byte-identical file, so you can copy the already-patched file over — back up first):
%USERPROFILE%\.vscode\extensions\moonshot-ai.kimi-code-*~/.vscode/extensions/moonshot-ai.kimi-code-*%USERPROFILE%\.antigravity-ide\extensions\moonshot-ai.kimi-code-*~/.antigravity-ide/extensions/moonshot-ai.kimi-code-*Notes for macOS
/Volumes/<share>, a normal POSIX path. The.gitwalk terminates at/, and stat returns plainENOENT, which the code already handles. NoUNKNOWNerror.Kimi Code: Show Logs) for the same error, then apply the patch steps above./Volumes/.git.darwin-arm64/darwin-x64; the bundle structure is the same. Search with:grep -ao '.\{80\}pathExists\$2.\{80\}' extension.jsRollback
Caveats
pathExists$1in agent-core-v2, around byte 7462143) that also rethrows. It was not patched (minimal-change principle — it is not the code path that caused this symptom). If a similar error with a different message ever appears, revisit that one.Draft: Bug report email to Moonshot (code@moonshot.ai)
To: code@moonshot.ai
Subject: Bug: VS Code extension 0.6.7 — chat fails on UNC (network share) workspaces:
stat '\\server\.git\'throws UNKNOWNKeep this file after sending — if they reply asking for more logs, everything is in here.
Draft: GitHub Issue (recommended — use this one)