[Bug] Error watching files: Operation not supported on socket (os error 102) about ["/path/to/project/.codegraph/daemon.sock"]
Author: HikerCoderCreated Jul 6, 2026Updated Jul 7, 2026
问题
项目根目录下有 .codegraph/daemon.sock(Unix socket),Mako watcher 监听到该文件变化后报错:
Error watching files: Operation not supported on socket (os error 102)
about ["/path/to/project/.codegraph/daemon.sock"]尝试过的方案
.gitignore加.codegraph— 无效,Mako watcher 是 Rust 层实现,不读.gitignoremako.config.json写{ "watch": { "ignoredPaths": [".codegraph"] } }— 无效config.ts写mako: { watch: { ignoredPaths: [".codegraph"] } }— 被supportMakoConfigKeys白名单拦截报错
根因分析
在 @umijs/[email protected] 的 dist/index.js 中,mako.config.json 解析后只合并了 3 个字段:
makoConfig.resolve.alias(第 96 行)makoConfig.sass(第 158-163 行)makoConfig.plugins(第 221 行)
makoConfig.watch 从未被读取或透传到 params.config,最终 Rust binding 收到的 watch 是顶层布尔值 true,导致全量监听无 ignore。
期望行为
mako.config.json 中的 watch.ignoredPaths 应被合并到 params.config.watch,最终传给 Rust binding。
复现
mkdir test-project && cd test-project
mkdir .codegraph
# 创建一个 socket 文件模拟 daemon.sock
node -e "require('net').createServer().listen('.codegraph/daemon.sock')"
# 然后启动 mako dev,watcher 会报错环境
@umijs/mako: 0.11.4@umijs/bundler-mako: 0.11.4- Umi: 4.x
- OS: macOS 15.x
Source: umijs/umi