You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 1, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Sep 1, 2026. It is now read-only.
tsgo --watch error: "error starting FSEvents stream" on large node_modules since the fswatch rewrite #4378
Since 7.0.0-dev.20260617.2, tsgo --watch fails to start its file watcher on projects with many watched directories (large/symlinked node_modules).
It prints the compile banner and then:
Starting compilation in watch mode...
failed to watch directory <abs path>/node_modules/.bun/<pkg>: error starting FSEvents stream
and never reaches Found N errors. Watching for file changes.
The one-shot compile (tsgo --noEmit) on the same project succeeds in < 1s, so only watch mode is affected.
I tried to exclude, but the native port seems to ignore watchOptions, so I can't exclude folders.
Steps to reproduce:
macOS 15.7.7 on M1 Max, Bun monorepo. The Bun .bun layout reproduces it immediately because each dependency is its own directory, but any tree large enough to hit the macOS FSEvents stream limit should reproduce.
In a project with a large node_modules (Bun .bun layout works well),
Observe error starting FSEvents stream, no compile cycle.
Best guess on the cause:
Last good 7.0.0-dev.20260616.1 (462a1a4), first bad 7.0.0-dev.20260617.2 (2fb5d4c). The only watcher-related change in that range is #4326 "Rebuilt build mode around fswatch package", building on the fswatch rewrite from #3980 / #4026. The new fswatch appears to fail to open an FSEvents stream once the watched-directory count is large.
I guess we need to be more clever about how we set up watchers on macOS if we're going to be using fsevents instead of kqueue. kqueue is really slow in our testing, but I think we just did not register things in a way that works (coalescing watches etc).
Random semi-related question; do you use Watchman?
Nope. I personally wrote a custom script (to be honest, AI helped) that starts the NestJS server and tsgo watcher. I wanted to prevent Nest restarts if TS has any errors. Here is the code - https://gist.github.com/Alex-Bond/2cf221984a855377080cc80410331144 (I didn't use LSP as it doesn't support workspace watching yet)
This is off topic, but I'm curious what you mean by this. Do you mean full workspace diagnostics?
As long as you don't ban me for off topic - yes. When i was working on trying to use LSP i got stuck at microsoft/TypeScript#63784. In my experiments, I end up with a response from LSP "diagnosticProvider": { "interFileDependencies": true, "workspaceDiagnostics": false }. It seems like it's planned, but not for the first release.
Also, can you try #4379 and see if you're able to use watch mode?
Activity
jakebailey commentedon Jun 19, 2026
I guess we need to be more clever about how we set up watchers on macOS if we're going to be using fsevents instead of kqueue. kqueue is really slow in our testing, but I think we just did not register things in a way that works (coalescing watches etc).
jakebailey commentedon Jun 19, 2026
Random semi-related question; do you use Watchman?
Alex-Bond commentedon Jun 19, 2026
Nope. I personally wrote a custom script (to be honest, AI helped) that starts the NestJS server and tsgo watcher. I wanted to prevent Nest restarts if TS has any errors. Here is the code - https://gist.github.com/Alex-Bond/2cf221984a855377080cc80410331144 (I didn't use LSP as it doesn't support workspace watching yet)
jakebailey commentedon Jun 19, 2026
This is off topic, but I'm curious what you mean by this. Do you mean full workspace diagnostics?
jakebailey commentedon Jun 19, 2026
Also, can you try #4379 and see if you're able to use watch mode?
Alex-Bond commentedon Jun 19, 2026
As long as you don't ban me for off topic - yes. When i was working on trying to use LSP i got stuck at microsoft/TypeScript#63784. In my experiments, I end up with a response from LSP
"diagnosticProvider": { "interFileDependencies": true, "workspaceDiagnostics": false }. It seems like it's planned, but not for the first release.It did resolve the issue. Thank you, Jake!
jakebailey commentedon Jun 19, 2026
I pushed to that PR after asking; did you try the current state?
For other stuff, if you think we're missing something, absolutely feel free to file an issue.
Alex-Bond commentedon Jun 19, 2026
Yup. I tried to compile and run with ce359c1