MoonshotAI / MoonshotAI/kimi-code
CLI 启动崩溃:ENOSPC file watchers reached(kimi / kimi -p / ACP 均复现,0.38.0)
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 7.5k
- Forks
- 1.2k
- Avg merge
- 11h 53m
- Merged PRs (30d)
- 350
Description
你运行的 Kimi Code 版本是?
0.38.0(kimi --version;已升级到当前最新仍复现)
你使用的是哪个开放平台/订阅?
未使用交互式 /login 做本次复现。直接启动 CLI 即可复现(见下)。
你使用的是哪个模型?
未进入可用会话,无法从状态栏读取模型 ID。kimi -p 在启动阶段即因文件监视失败退出。
你的电脑平台是?
Linux x86_64;Node.js v22.19.0
你遇到了什么问题?
不仅是 ACP。 直接运行 kimi 或 kimi -p "ping" 也会失败(exit code 1)。根因是启动时用 fs.watch 监视 ~/.kimi-code,在 inotify watch 数量耗尽时抛出未捕获的 ENOSPC。
命令:
kimi -p "ping"
stderr(已打码本机用户目录为 ~):
kimi version 0.38.0
[unexpected] Error: ENOSPC: System limit for number of file watchers reached, watch '~/.kimi-code'
at FSWatcher.<computed> (node:internal/fs/watchers:316:19)
at watch (node:fs:2538:36)
at createFsWatchInstance (.../apps/kimi-code/dist-native/intermediates/main.cjs:220381:23)
at setFsWatchListener (.../apps/kimi-code/dist-native/intermediates/main.cjs:220729:14)
at NodeFsHandler._watchWithNodeFs (.../apps/kimi-code/dist-native/intermediates/main.cjs:220828:20)
at NodeFsHandler._handleDir (.../apps/kimi-code/dist-native/intermediates/main.cjs:220989:19)
at async NodeFsHandler._addToNodeFs (.../apps/kimi-code/dist-native/intermediates/main.cjs:221029:15)
{
errno: -28,
syscall: 'watch',
code: 'ENOSPC',
path: '~/.kimi-code',
filename: '~/.kimi-code'
}
同一错误还会出现在 ~/.kimi-code/config.toml、~/.kimi-code/device_id、~/.kimi-code/migrations-effort.json 等路径上。
交互式 kimi 同样在启动时打印上述 [unexpected] Error(exit 1)。
第三方 ACP 宿主因此表现为 session/new 失败、ACP 进程退出——那是同一启动崩溃的后果,不是 ACP 独有问题。
复现步骤?
- 安装 Kimi Code CLI 0.38.0(Linux)。
- 在 inotify
max_user_watches已被占满的环境(本机当前为 65535)。 - 运行
kimi -p "ping"或直接kimi。 - 进程以 exit 1 退出,stderr 为
ENOSPC: System limit for number of file watchers reached。
期望的行为是什么?
- 监视
~/.kimi-code失败时不应让整个进程崩溃。 - 应降级为不 watch / 轮询 / 警告后继续启动,或给出明确的用户可见提示(如何提高 inotify 限制),而不是未捕获异常退出。
- ACP 模式下同样应返回结构化错误或继续运行,而不是进程直接退出。
补充信息
kimi --version可以成功打印版本;崩溃发生在随后的 fs.watch 初始化。- 本机
/proc/sys/fs/inotify/max_user_watches= 312292,仍被占满。 - 未粘贴 token、完整配置、绝对用户路径或其他环境变量。
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the fs.watch initialization for ~/.kimi-code shown in apps/kimi-code/dist-native/intermediates/main.cjs and reproduce with kimi -p "ping" or kimi. Trace how ENOSPC is handled during startup; done means watcher exhaustion no longer causes an uncaught exit, and the CLI either continues safely or gives a clear user-visible message, including in ACP mode.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- linux, node.js, typescript
- Domain
- cli, operating-systems
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 65/100