TypeScript language server constantly crashing

Using Cursor v0.45.7 and TS 5.6.3 on macOS 15.2. I constantly get the error

TypeScript language server exited with error. Error message is: Channel closed

Cursor would also get stuck on indexing/analyzing multiple files.
I came across this VSCode issue and have prepared the log described there, but it does contain lots of info, so Im ready to share any important parts of it.
My teammates dont seem to have this issue.

Hey, open the DevTools panel and check for any errors there. Also, open the Output panel, go to the menu, and select TypeScript, there might be some errors there as well. Additionally, try clearing the cache.

The error in dev tools is the same “TypeScript language server exited with error. Error message is: Channel closed”.
TS logging is on debug and in the log the only lines that look like errors/fails are similar to:

Info 13769[17:08:51.000] FileWatcher:: Added:: WatchInfo: /Users/.../apps/viteapp/package.json 250 undefined WatchType: package.json file
Info 13770[17:08:51.000] FileWatcher:: Added:: WatchInfo: /Users/.../package.json 250 undefined WatchType: package.json file
Info 13771[17:08:51.000] event:
    {"seq":0,"type":"event","event":"createFileWatcher","body":{"id":6286,"path":"/Users/.../package.json"}}
Info 13772[17:08:51.025] AutoImportProviderProject: attempted to add more than 10 dependencies. Aborting.


Info 4295 [17:08:49.286] Elapsed:: 0.006042000000888947ms DirectoryWatcher:: Added:: WatchInfo: /Users/.../apps/viteapp/vite 1 undefined Project: /Users/.../apps/viteapp/tsconfig.json WatchType: Failed Lookup Locations
Info 4296 [17:08:49.286] FileWatcher:: Added:: WatchInfo: /Users/.../node_modules/lightningcss/package.json 2000 undefined Project: /Users/.../apps/viteapp/tsconfig.json WatchType: File location affecting resolution


-view-state.ts 500 undefined WatchType: Closed Script info

Not exactly sure what Im looking for in there.
Tried clearing cache via “Clear Editor History”

The logs here don’t look to show us what the reason is for the server ending, can you try setting your log level to Verbose?

Ive gathered a TS log with “Trace” level, I can see the “TSServer errored with error. Channel closed” but nothing else specific before it, just syntax/semantic/diagnostics calls. What should I be looking for?

I was trying to improve our tsserver performance, and after noticing a lot of lag in adding watchers in the log, I found this issue that is resolved in the latest vscode. Nonresponsive editor with large project when `typescript.tsserver.watchOptions: vscode` · Issue #237351 · microsoft/vscode · GitHub

I verified vscode 1.97 works much better. Hopefully we can get a fix soon, since this is costing our team of Cursor lovers a lot of time.

1 Like

Thanks for sharing that issue!

We’re aware of this and are working on updating our VSCode version which should fix these tsserver watcher problems. For now, you could try setting typescript.tsserver.watchOptions to "usefsevents" in your settings - this might help reduce the watcher overhead