vscode: TypeScript Server Error: No project

Been getting this error for over year on various typescript versions. Saw this tweet and decided to finally do something about it.

Error:

  ERR <semantic> TypeScript Server Error (3.7.3)
No Project.
Error: No Project.
    at Object.ThrowNoProject (tsserver.js:133314:23)
    at ScriptInfo.getDefaultProject (tsserver.js:134061:46)
    at ProjectService.doEnsureDefaultProjectForFile (tsserver.js:136599:48)
    at ProjectService.ensureDefaultProjectForFile (tsserver.js:136594:75)
    at IOSession.Session.getFileAndProjectWorker (tsserver.js:140251:87)
    at IOSession.Session.getFileAndProject (tsserver.js:140234:29)
    at IOSession.Session.getDocumentHighlights (tsserver.js:140077:31)
    at Session.handlers.ts.createMapFromTemplate._a.<computed> (tsserver.js:139501:61)
    at tsserver.js:140929:88
    at IOSession.Session.executeWithRequestId (tsserver.js:140920:28)
    at IOSession.Session.executeCommand (tsserver.js:140929:33)
    at IOSession.Session.onMessage (tsserver.js:140952:35)
    at Interface.<anonymous> (tsserver.js:142267:27)
    at Interface.emit (events.js:200:13)
    at Interface._onLine (readline.js:314:10)
    at Interface._normalWrite (readline.js:459:12)
    at Socket.ondata (readline.js:170:10)
    at Socket.emit (events.js:200:13)
    at addChunk (_stream_readable.js:294:12)
    at readableAddChunk (_stream_readable.js:275:11)
    at Socket.Readable.push (_stream_readable.js:210:10)
    at Pipe.onStreamRead (internal/stream_base_commons.js:166:17): Error: <semantic> TypeScript Server Error (3.7.3)
No Project.
Error: No Project.
    at Object.ThrowNoProject (tsserver.js:133314:23)
    at ScriptInfo.getDefaultProject (tsserver.js:134061:46)
    at ProjectService.doEnsureDefaultProjectForFile (tsserver.js:136599:48)
    at ProjectService.ensureDefaultProjectForFile (tsserver.js:136594:75)
    at IOSession.Session.getFileAndProjectWorker (tsserver.js:140251:87)
    at IOSession.Session.getFileAndProject (tsserver.js:140234:29)
    at IOSession.Session.getDocumentHighlights (tsserver.js:140077:31)
    at Session.handlers.ts.createMapFromTemplate._a.<computed> (tsserver.js:139501:61)
    at tsserver.js:140929:88
    at IOSession.Session.executeWithRequestId (tsserver.js:140920:28)
    at IOSession.Session.executeCommand (tsserver.js:140929:33)
    at IOSession.Session.onMessage (tsserver.js:140952:35)
    at Interface.<anonymous> (tsserver.js:142267:27)
    at Interface.emit (events.js:200:13)
    at Interface._onLine (readline.js:314:10)
    at Interface._normalWrite (readline.js:459:12)
    at Socket.ondata (readline.js:170:10)
    at Socket.emit (events.js:200:13)
    at addChunk (_stream_readable.js:294:12)
    at readableAddChunk (_stream_readable.js:275:11)
    at Socket.Readable.push (_stream_readable.js:210:10)
    at Pipe.onStreamRead (internal/stream_base_commons.js:166:17)
	at Function.create (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/typescript-language-features/dist/extension.js:1:47388)
	at h.dispatchResponse (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/typescript-language-features/dist/extension.js:1:206557)
	at h.dispatchMessage (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/typescript-language-features/dist/extension.js:1:205455)
	at /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/typescript-language-features/dist/extension.js:1:204931
	at l.fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:46:893)
	at t.Reader.onLengthData (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/typescript-language-features/dist/extension.js:1:212021)
	at Socket.<anonymous> (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/typescript-language-features/dist/extension.js:1:211669)
	at Socket.emit (events.js:200:13)
	at addChunk (_stream_readable.js:294:12)
	at readableAddChunk (_stream_readable.js:275:11)
	at Socket.Readable.push (_stream_readable.js:210:10)
	at Pipe.onStreamRead (internal/stream_base_commons.js:166:17)

Gist of tsserver log

TypeScript Version: 3.7.3

Expected behavior: TypeScript server to just work

Actual behavior: Suggestions/hints stop working, autocomplete stops working, under random, extreme circumstances I’ll lose syntax highlighting

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 5
  • Comments: 21 (7 by maintainers)

Most upvoted comments

I get the same/similar error when trying to ‘Rename Symbol’ or press F2 in VS Code. Could it be the same issue?

I see this on “Find All References” and “Rename Symbol” operations that trigger large project loads as well. After debugging tsserver to inspect process state, I realized that it’s actually the next tsserver process throwing the "No project" error. The first process that I was inspecting simply crashed after running out of memory. (The Chrome debugger showed “paused before potential out-of-memory exception”.) VSCode then spun up a second tsserver process to get it to takeover the reference search.

I think this specific exception is a VSCode bug. VSCode should probably detect when tsserver exits unexpectedly and cancel requests that require a project loaded. Instead it’s still doing projectInfo commands before openFile commands.

Log of second tsserver here: https://gist.github.com/gluxon/743888c904478fbfbd02ad495aeccd7c

+1 with 3.9.4. It seems to me that this exception triggers once the project reaches a certain treshold of inclusions in the tsconfig.json file . Once I minimized the surface there I got rid of the exception.