Skip to content

VS Code - TypeScript Server Error - Type check, auto complete, etc. stops working preiodically #32086

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
AnyhowStep opened this issue Jun 25, 2019 · 12 comments · Fixed by #32167
Assignees
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@AnyhowStep
Copy link
Contributor

AnyhowStep commented Jun 25, 2019

TypeScript Version: 3.5.1

Search Terms:

typescript server error, debug failure

Code

I seem to get two kinds of error messages in the VS Code developer tools,

ERR TypeScript Server Error (3.5.1)
Debug Failure. Expected 26789 <= 24601
Error: Debug Failure. Expected 26789 <= 24601
    at Object.assertLessThanOrEqual (tsserver.js:2059:17)
    at Object.createFileDiagnostic (tsserver.js:15141:22)
    at getRangeToExtract (tsserver.js:118016:42)
    at Object.getAvailableActions (tsserver.js:117879:38)
    at tsserver.js:112870:128
    at getIterator (tsserver.js:627:23)
    at Object.next (tsserver.js:622:35)
    at Object.arrayFrom (tsserver.js:1255:32)
    at Object.getApplicableRefactors (tsserver.js:112869:23)
    at Object.getApplicableRefactors (tsserver.js:122632:32)
    at IOSession.Session.getApplicableRefactors (tsserver.js:131393:53)
    at Session.handlers.ts.createMapFromTemplate._a.(anonymous function) (tsserver.js:130211:61)
    at tsserver.js:131637:88
    at IOSession.Session.executeWithRequestId (tsserver.js:131628:28)
    at IOSession.Session.executeCommand (tsserver.js:131637:33)
    at IOSession.Session.onMessage (tsserver.js:131659:35)
    at Interface.<anonymous> (tsserver.js:132950:27)
    at Interface.emit (events.js:182:13)
    at Interface._onLine (readline.js:290:10)
    at Interface._normalWrite (readline.js:433:12)
    at Socket.ondata (readline.js:149:10)
    at Socket.emit (events.js:182:13)
    at addChunk (_stream_readable.js:279:12)
    at readableAddChunk (_stream_readable.js:264:11)
    at Socket.Readable.push (_stream_readable.js:219:10)
    at Pipe.onread (net.js:636:20): Error: TypeScript Server Error (3.5.1)
Debug Failure. Expected 26789 <= 24601
Error: Debug Failure. Expected 26789 <= 24601
    at Object.assertLessThanOrEqual (tsserver.js:2059:17)
    at Object.createFileDiagnostic (tsserver.js:15141:22)
    at getRangeToExtract (tsserver.js:118016:42)
    at Object.getAvailableActions (tsserver.js:117879:38)
    at tsserver.js:112870:128
    at getIterator (tsserver.js:627:23)
    at Object.next (tsserver.js:622:35)
    at Object.arrayFrom (tsserver.js:1255:32)
    at Object.getApplicableRefactors (tsserver.js:112869:23)
    at Object.getApplicableRefactors (tsserver.js:122632:32)
    at IOSession.Session.getApplicableRefactors (tsserver.js:131393:53)
    at Session.handlers.ts.createMapFromTemplate._a.(anonymous function) (tsserver.js:130211:61)
    at tsserver.js:131637:88
    at IOSession.Session.executeWithRequestId (tsserver.js:131628:28)
    at IOSession.Session.executeCommand (tsserver.js:131637:33)
    at IOSession.Session.onMessage (tsserver.js:131659:35)
    at Interface.<anonymous> (tsserver.js:132950:27)
    at Interface.emit (events.js:182:13)
    at Interface._onLine (readline.js:290:10)
    at Interface._normalWrite (readline.js:433:12)
    at Socket.ondata (readline.js:149:10)
    at Socket.emit (events.js:182:13)
    at addChunk (_stream_readable.js:279:12)
    at readableAddChunk (_stream_readable.js:264:11)
    at Socket.Readable.push (_stream_readable.js:219:10)
    at Pipe.onread (net.js:636:20)
	at Function.create (/usr/share/code/resources/app/extensions/typescript-language-features/dist/extension.js:1:173406)
	at v.dispatchResponse (/usr/share/code/resources/app/extensions/typescript-language-features/dist/extension.js:1:178712)
	at v.dispatchMessage (/usr/share/code/resources/app/extensions/typescript-language-features/dist/extension.js:1:177464)
	at constructor._reader.onData.e (/usr/share/code/resources/app/extensions/typescript-language-features/dist/extension.js:1:176820)
	at u.fire (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:43:254)
	at t.Reader.onLengthData (/usr/share/code/resources/app/extensions/typescript-language-features/dist/extension.js:1:182680)
	at Socket.t.Reader.constructor.e.on.e (/usr/share/code/resources/app/extensions/typescript-language-features/dist/extension.js:1:182328)
	at Socket.emit (events.js:182:13)
	at addChunk (_stream_readable.js:279:12)
	at readableAddChunk (_stream_readable.js:264:11)
	at Socket.Readable.push (_stream_readable.js:219:10)
	at Pipe.onread (net.js:636:20)

And,

TypeScript Server Error (3.5.1)
Debug Failure. False expression.
Error: Debug Failure. False expression.
    at tryReuseStructureFromOldProgram (tsserver.js:89636:22)
    at Object.createProgram (tsserver.js:89289:34)
    at synchronizeHostData (tsserver.js:121943:26)
    at Object.getProgram (tsserver.js:122035:13)
    at ConfiguredProject.Project.updateGraphWorker (tsserver.js:126284:53)
    at ConfiguredProject.Project.updateGraph (tsserver.js:126228:42)
    at ConfiguredProject.updateGraph (tsserver.js:126723:63)
    at Object.updateProjectIfDirty (tsserver.js:127081:45)
    at ConfiguredProject.Project.getLanguageService (tsserver.js:125915:28)
    at IOSession.Session.getCompletions (tsserver.js:131119:43)
    at Session.handlers.ts.createMapFromTemplate._a.(anonymous function) (tsserver.js:130069:61)
    at tsserver.js:131637:88
    at IOSession.Session.executeWithRequestId (tsserver.js:131628:28)
    at IOSession.Session.executeCommand (tsserver.js:131637:33)
    at IOSession.Session.onMessage (tsserver.js:131659:35)
    at Interface.<anonymous> (tsserver.js:132950:27)
    at Interface.emit (events.js:182:13)
    at Interface._onLine (readline.js:290:10)
    at Interface._normalWrite (readline.js:433:12)
    at Socket.ondata (readline.js:149:10)
    at Socket.emit (events.js:182:13)
    at addChunk (_stream_readable.js:279:12)
    at readableAddChunk (_stream_readable.js:264:11)
    at Socket.Readable.push (_stream_readable.js:219:10)
    at Pipe.onread (net.js:636:20): Error: TypeScript Server Error (3.5.1)
Debug Failure. False expression.
Error: Debug Failure. False expression.
    at tryReuseStructureFromOldProgram (tsserver.js:89636:22)
    at Object.createProgram (tsserver.js:89289:34)
    at synchronizeHostData (tsserver.js:121943:26)
    at Object.getProgram (tsserver.js:122035:13)
    at ConfiguredProject.Project.updateGraphWorker (tsserver.js:126284:53)
    at ConfiguredProject.Project.updateGraph (tsserver.js:126228:42)
    at ConfiguredProject.updateGraph (tsserver.js:126723:63)
    at Object.updateProjectIfDirty (tsserver.js:127081:45)
    at ConfiguredProject.Project.getLanguageService (tsserver.js:125915:28)
    at IOSession.Session.getCompletions (tsserver.js:131119:43)
    at Session.handlers.ts.createMapFromTemplate._a.(anonymous function) (tsserver.js:130069:61)
    at tsserver.js:131637:88
    at IOSession.Session.executeWithRequestId (tsserver.js:131628:28)
    at IOSession.Session.executeCommand (tsserver.js:131637:33)
    at IOSession.Session.onMessage (tsserver.js:131659:35)
    at Interface.<anonymous> (tsserver.js:132950:27)
    at Interface.emit (events.js:182:13)
    at Interface._onLine (readline.js:290:10)
    at Interface._normalWrite (readline.js:433:12)
    at Socket.ondata (readline.js:149:10)
    at Socket.emit (events.js:182:13)
    at addChunk (_stream_readable.js:279:12)
    at readableAddChunk (_stream_readable.js:264:11)
    at Socket.Readable.push (_stream_readable.js:219:10)
    at Pipe.onread (net.js:636:20)
	at Function.create (/usr/share/code/resources/app/extensions/typescript-language-features/dist/extension.js:1:173406)
	at v.dispatchResponse (/usr/share/code/resources/app/extensions/typescript-language-features/dist/extension.js:1:178712)
	at v.dispatchMessage (/usr/share/code/resources/app/extensions/typescript-language-features/dist/extension.js:1:177464)
	at constructor._reader.onData.e (/usr/share/code/resources/app/extensions/typescript-language-features/dist/extension.js:1:176820)
	at u.fire (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:43:254)
	at t.Reader.onLengthData (/usr/share/code/resources/app/extensions/typescript-language-features/dist/extension.js:1:182680)
	at Socket.t.Reader.constructor.e.on.e (/usr/share/code/resources/app/extensions/typescript-language-features/dist/extension.js:1:182328)
	at Socket.emit (events.js:182:13)
	at addChunk (_stream_readable.js:279:12)
	at readableAddChunk (_stream_readable.js:264:11)
	at Socket.Readable.push (_stream_readable.js:219:10)
	at Pipe.onread (net.js:636:20)

The log just gets spammed continuously.

Expected behavior:

Type check, auto complete, etc. should consistently work

Actual behavior:

When I restart VS code, everything works fine.

Then, a while later (seconds/minutes; usually minutes), it just stops working and I get errors in the VS code developer tools console tab. If I restart VS code ("Reload window"), everything works fine again for a while, until those errors come back.

tsc works fine.

tsc -b -w works fine.

The project I'm working on is a composite project with 30+ sub-projects.

Version: 1.32.3
Commit: a3db5be9b5c6ba46bb7555ec5d60178ecc2eaae4
Date: 2019-03-14T23:38:49.842Z
Electron: 3.1.6
Chrome: 66.0.3359.181
Node.js: 10.2.0
V8: 6.6.346.32
OS: Linux x64 4.18.0-20-generic

Not sure what other information I should provide.


It's kind of hard for me to reproduce the issue at will. I'm just writing a bunch of tests and every now and then, things just stop working.

Playground Link: None

Related Issues:

No idea, maybe #30546 ?

But the logs seem very different.

@AnyhowStep AnyhowStep changed the title VS Code - TypeScript Server Error - Type check, auto complete, etc. stop working VS Code - TypeScript Server Error - Type check, auto complete, etc. stops working preiodically Jun 25, 2019
@sheetalkamat
Copy link
Member

@AnyhowStep Can you please turn on the tsserver log and when the issue reproduces share the complete log. That would make investigating this easier since from your description it happens only certain times, it feels like the action sequence might help what went wrong. If you want to share tsserver log more privately here are the steps.

  1. With "typescript.tsserver.log": "verbose" enabled
  2. Restart vscode or vscode insiders
  3. Reproduce the problem
  4. You can share the logs using
    • either by sharing logs in the folder that gets opened by running open tsserver log from command palette
      or
    • Run code --upload-logs on the command line (or code-insiders --upload-logs if using vscode insiders) and follow instructions and Then share the log file ID

@sheetalkamat sheetalkamat added the Needs More Info The issue still hasn't been fully clarified label Jun 25, 2019
@AnyhowStep
Copy link
Contributor Author

I ran code --upload-logs and it told me to review the ~/.config/Code/logs/20190530T202503 directory.

However, when I run open tsserver log, it opens ~/.config/Code/logs/20190615T191737/exthost84/vscode.typescript-language-features/tsserver-log-Z1gGqW and contains tsserver.log, ti-28173.log

The timestamps seem different.

  • 20190530T202503
  • 20190615T191737

Do I just use code --upload-logs anyway? Is there a way to get code to upload the directory open tsserver log shows me?

@AnyhowStep
Copy link
Contributor Author

@sheetalkamat

Upload successful! Log file ID: 861168024

@sheetalkamat sheetalkamat added Bug A bug in TypeScript and removed Needs More Info The issue still hasn't been fully clarified labels Jun 28, 2019
@sheetalkamat sheetalkamat self-assigned this Jun 28, 2019
@sheetalkamat sheetalkamat added this to the TypeScript 3.6.0 milestone Jun 28, 2019
@sheetalkamat sheetalkamat added Fixed A PR has been merged for this issue Needs More Info The issue still hasn't been fully clarified Bug A bug in TypeScript and removed Bug A bug in TypeScript Fixed A PR has been merged for this issue Needs More Info The issue still hasn't been fully clarified labels Jun 28, 2019
sheetalkamat added a commit that referenced this issue Jun 28, 2019
…olvedPath since thats how the source files are queried and thats the real path

Fixes #32086
@sheetalkamat sheetalkamat added the Fixed A PR has been merged for this issue label Jun 28, 2019
@nikunjdnp
Copy link

Hi, I am getting the typescript server error when I format the code in vs code.
My vscode version:

Version: 1.39.1 (system setup)
Commit: 88f15d17dca836346e787762685a40bb5cce75a8
Date: 2019-10-10T23:31:28.683Z
Electron: 4.2.10
Chrome: 69.0.3497.128
Node.js: 10.11.0
V8: 6.9.427.31-electron.0
OS: Windows_NT x64 10.0.18362

Error:
TypeScript Server Error (3.6.3) Debug Failure. False expression: Token end is child end Error: Debug Failure. False expression: Token end is child end at processChildNode (tsserver.js:113630:34) at tsserver.js:113577:21 at visitNode (tsserver.js:17019:24) at Object.forEachChild (tsserver.js:17423:21) at processNode (tsserver.js:113576:20) at processChildNode (tsserver.js:113636:21) at processChildNodes (tsserver.js:113687:48) at tsserver.js:113579:21 at visitNodes (tsserver.js:17024:24) at Object.forEachChild (tsserver.js:17420:24) at processNode (tsserver.js:113576:20) at processChildNode (tsserver.js:113636:21) at tsserver.js:113577:21 at visitNode (tsserver.js:17019:24) at Object.forEachChild (tsserver.js:17418:21) at processNode (tsserver.js:113576:20) at processChildNode (tsserver.js:113636:21) at tsserver.js:113577:21 at visitNode (tsserver.js:17019:24) at Object.forEachChild (tsserver.js:174...

Can anyone please help me?

Thanks,
Nikunj

@amirxnz
Copy link

amirxnz commented Nov 4, 2019

@nikunjdnp I am also seeing this issue, can anyone help?

Thanks

@turbozv
Copy link

turbozv commented Nov 5, 2019

+1, also seeing this error from latest version:

TypeScript Server Error (3.6.3) Debug Failure. Error: Debug Failure. at Object.assertDefined (tsserver.js:2101:24) at Object.argumentStartsOnSameLineAsPreviousArgument (tsserver.js:114419:48) at computeIndentation (tsserver.js:113449:55) at processChildNode (tsserver.js:113635:44) at processChildNodes (tsserver.js:113687:48) at tsserver.js:113579:21 at visitNodes (tsserver.js:17024:24) at Object.forEachChild (tsserver.js:17207:21) at processNode (tsserver.js:113576:20) at processChildNode (tsserver.js:113636:21) at tsserver.js:113577:21 at visitNode (tsserver.js:17019:24) at Object.forEachChild (tsserver.js:17093:21) at processNode (tsserver.js:113576:20) at processChildNode (tsserver.js:113636:21) at processChildNodes (tsserver.js:113687:48) at tsserver.js:113579:21 at visitNodes (tsserver.js:17024:24) at Object.forEachChild (tsserver.js:17329:21) at processNode (tsserver.js:113576:20) at proc...

@lazysergey
Copy link

still there when formatting tsx

@orta
Copy link
Contributor

orta commented Nov 30, 2019

Could you pass along some sample code which causes the crash? There are no repros in this issue - extra points if you can make it crash the playground too

@gabrielsaints
Copy link

I'm also seeing this, any fix?

@tuanphamanh91
Copy link

@turbozv @cahtyw
Hi,
I just resolved this problem. this is my step:

  1. remove Prettier - Code Formatter extension and re-install
  2. Right-click and select Format document with...
  3. Select TypeScript and Javascript Language Features
  4. Select Prettier.
    So the problem went away. I hope this can help

@techsin
Copy link

techsin commented Dec 12, 2019

same problem +1

@felixpk
Copy link

felixpk commented Mar 6, 2020

OS: Ubuntu 19.10
VS Code: 1.42.1 (c47d83b293181d9be64f27ff093689e8e7aed054) x64

The only enabled (and relevant) Extension is:
Name: ES7 React/Redux/GraphQL/React-Native snippets
Id: dsznajder.es7-react-js-snippets
Description: Simple extensions for React, Redux and Graphql in JS/TS with ES7 syntax
Version: 2.6.0
Publisher: dsznajder
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=dsznajder.es7-react-js-snippets

<syntax> TypeScript Server Error (3.7.5)
Debug Failure. False expression: Token end is child end
Error: Debug Failure. False expression: Token end is child end
    at processChildNode (tsserver.js:118166:34)
    at tsserver.js:118107:21
    at visitNode (tsserver.js:17626:24)
    at Object.forEachChild (tsserver.js:18035:21)
    at processNode (tsserver.js:118106:20)
    at processChildNode (tsserver.js:118172:21)
    at processChildNodes (tsserver.js:118223:48)
    at tsserver.js:118109:21
    at visitNodes (tsserver.js:17631:24)
    at Object.forEachChild (tsserver.js:18032:24)
    at processNode (tsserver.js:118106:20)
    at processChildNode (tsserver.js:118172:21)
    at tsserver.js:118107:21
    at visitNode (tsserver.js:17626:24)
    at Object.forEachChild (tsserver.js:18030:21)
    at processNode (tsserver.js:118106:20)
    at processChildNode (tsserver.js:118172:21)
    at processChildNodes (tsserver.js:118223:48)
    at tsserver.js:118109:21
    at visitNodes (tsserver.js:17631:24)
    at Object.forEachChild (tsserver.js:18020:21)
    at processNode (tsserver.js:118106:20)
    at processChildNode (tsserver.js:118172:21)
    at tsserver.js:118107:21
    at visitNode (tsserver.js:17626:24)
    at Object.forEachChild (tsserver.js:17829:24)
    at processNode (tsserver.js:118106:20)
    at processChildNode (tsserver.js:118172:21)
    at tsserver.js:118107:21
    at visitNode (tsserver.js:17626:24)
    at Object.forEachChild (tsserver.js:17906:24)
    at processNode (tsserver.js:118106:20)
    at processChildNode (tsserver.js:118172:21)
    at processChildNodes (tsserver.js:118223:48)
    at tsserver.js:118109:21
    at visitNodes (tsserver.js:17631:24)
    at Object.forEachChild (tsserver.js:17866:24)
    at processNode (tsserver.js:118106:20)
    at processChildNode (tsserver.js:118172:21)
    at tsserver.js:118107:21
    at visitNode (tsserver.js:17626:24)
    at Object.forEachChild (tsserver.js:17756:21)
    at processNode (tsserver.js:118106:20)
    at processChildNode (tsserver.js:118172:21)
    at processChildNodes (tsserver.js:118223:48)
    at tsserver.js:118109:21
    at visitNodes (tsserver.js:17631:24)
    at Object.forEachChild (tsserver.js:17868:24)
    at processNode (tsserver.js:118106:20)
    at formatSpanWorker (tsserver.js:117921:17)
    at tsserver.js:117902:208
    at Object.getFormattingScanner (tsserver.js:116552:23)
    at formatSpan (tsserver.js:117902:31)
    at Object.formatSelection (tsserver.js:117720:20)
    at Proxy.getFormattingEditsForRange (tsserver.js:131084:34)
    at IOSession.Session.getFormattingEditsForRange (tsserver.js:140370:45)
    at Session.handlers.ts.createMapFromTemplate._a.<computed> (tsserver.js:139410:61)
    at tsserver.js:140960:88
    at IOSession.Session.executeWithRequestId (tsserver.js:140951:28)
    at IOSession.Session.executeCommand (tsserver.js:140960:33)
    at IOSession.Session.onMessage (tsserver.js:140983:35)
    at Interface.<anonymous> (tsserver.js:142298: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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue
Projects
None yet