microsoft / TypeScript

TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
https://www.typescriptlang.org
Apache License 2.0
101.12k stars 12.5k forks source link

TS Server fatal error: Debug Failure. Expected -1 >= 0 #39202

Closed cmcneese closed 3 years ago

cmcneese commented 4 years ago

Issue Type: Bug

TypeScript Version: 3.9.4 Steps to reproduce crash 1. 2. 3. TS Server Error Stack

Error: Debug Failure. Expected -1 >= 0
    at Object.createFileDiagnostic (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:17716:18)
    at parseErrorAtPosition (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:19834:42)
    at parseErrorAt (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:19841:13)
    at parseJsxChild (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:22843:25)
    at parseJsxChildren (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:22866:29)
    at parseJsxElementOrSelfClosingElementOrFragment (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:22782:33)
    at parseJsxChild (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:22855:28)
    at parseJsxChildren (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:22866:29)
    at parseJsxElementOrSelfClosingElementOrFragment (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:22782:33)
    at parseJsxChild (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:22855:28)
    at parseJsxChildren (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:22866:29)
    at parseJsxElementOrSelfClosingElementOrFragment (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:22782:33)
    at parseUpdateExpression (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:22625:24)
    at parseUnaryExpressionOrHigher (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:22499:40)
    at parseBinaryExpressionOrHigher (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:22359:31)
    at parseAssignmentExpressionOrHigher (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:22000:24)
    at parseExpression (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:21948:24)
    at doOutsideOfContext (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:19767:20)
    at allowInAnd (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:19789:20)
    at parseParenthesizedExpression (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:23293:31)
    at parsePrimaryExpression (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:23260:28)
    at parseMemberExpressionOrHigher (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:22752:30)
    at parseLeftHandSideExpressionOrHigher (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:22697:92)
    at parseUpdateExpression (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:22627:30)
    at parseUnaryExpressionOrHigher (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:22499:40)
    at parseBinaryExpressionOrHigher (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:22359:31)
    at parseAssignmentExpressionOrHigher (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:22000:24)
    at parseExpression (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:21948:24)
    at doOutsideOfContext (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:19767:20)
    at allowInAnd (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:19789:20)
    at parseReturnStatement (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:23584:35)
    at parseStatement (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:23883:28)
    at parseListElement (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:20487:20)
    at parseList (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:20471:35)
    at parseBlock (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:23453:35)
    at parseFunctionBlock (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:23477:25)
    at parseFunctionBlockOrSemicolon (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:24016:20)
    at parseMethodDeclaration (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:24172:25)
    at parsePropertyOrMethodDeclaration (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:24192:24)
    at parseClassElement (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:24358:28)
    at parseListElement (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:20487:20)
    at parseList (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:20471:35)
    at parseClassMembers (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:24436:20)
    at parseClassDeclarationOrExpression (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:24384:32)
    at parseClassDeclaration (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:24373:20)
    at parseStatement (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:23869:28)
    at parseListElement (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:20487:20)
    at parseList (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:20471:35)
    at parseSourceFileWorker (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:19673:37)
    at Object.parseSourceFile (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:19536:26)
    at Object.createSourceFile (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:19359:29)
    at Object.createLanguageServiceSourceFile (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:138493:29)
    at acquireOrUpdateDocument (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:114864:37)
    at Object.acquireDocumentWithKey (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:114837:20)
    at getOrCreateSourceFileByPath (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:138809:41)
    at Object.getOrCreateSourceFile [as getSourceFile] (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:138761:24)
    at findSourceFile (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:101363:29)
    at processImportedModules (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:101704:25)
    at findSourceFile (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:101411:17)
    at processImportedModules (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:101704:25)
    at findSourceFile (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:101411:17)
    at /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:101240:85
    at getSourceFileFromReferenceWorker (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:101207:34)
    at processSourceFile (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:101240:13)
    at processRootFile (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:101063:13)
    at /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:99987:60
    at Object.forEach (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:167:30)
    at Object.createProgram (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:99987:16)
    at synchronizeHostData (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:138726:26)
    at Proxy.getProgram (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:138818:13)
    at InferredProject.Project.updateGraphWorker (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:143310:53)
    at InferredProject.Project.updateGraph (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:143253:42)
    at ProjectService.assignOrphanScriptInfoToInferredProject (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:145149:25)
    at ProjectService.assignProjectToOpenedScriptInfo (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:146643:26)
    at /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:146900:97
    at Object.flatMap (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:465:25)
    at ProjectService.applyChangesInOpenFiles (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:146900:41)
    at Session.handlers.ts.createMapFromTemplate._a.<computed> (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:147763:46)
    at /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:149526:88
    at IOSession.Session.executeWithRequestId (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:149517:28)
    at IOSession.Session.executeCommand (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:149526:33)
    at IOSession.Session.onMessage (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:149550:35)
    at Interface.<anonymous> (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:150866:27)
    at Interface.emit (events.js:203:13)
    at Interface._onLine (readline.js:316:10)
    at Interface._normalWrite (readline.js:461:12)
    at Socket.ondata (readline.js:172:10)
    at Socket.emit (events.js:203:13)
    at addChunk (_stream_readable.js:295:12)
    at readableAddChunk (_stream_readable.js:276:11)
    at Socket.Readable.push (_stream_readable.js:210:10)
    at Pipe.onStreamRead (internal/stream_base_commons.js:166:17)

VS Code version: Code 1.46.1 (cd9ea6488829f560dc949a8b2fb789f3cdc05f5d, 2020-06-17T21:17:14.222Z) OS version: Darwin x64 19.5.0

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i5-7267U CPU @ 3.10GHz (4 x 3100)| |GPU Status|2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
protected_video_decode: unavailable_off
rasterization: enabled
skia_renderer: disabled_off_ok
video_decode: enabled
viz_display_compositor: enabled_on
viz_hit_test_surface_layer: disabled_off_ok
webgl: enabled
webgl2: enabled| |Load (avg)|4, 4, 3| |Memory (System)|8.00GB (0.07GB free)| |Process Argv|-psn_0_7227108| |Screen Reader|no| |VM|0%|
Extensions (81) Extension|Author (truncated)|Version ---|---|--- html-snippets|abu|0.2.1 vscode-javascript-snippet-pack|aka|0.1.5 react-pure-to-class-vscode|ang|1.1.8 ACF-Snippet|ant|1.9.0 gutensnip|ash|1.0.5 vscode-twig-pack|baj|1.1.0 git-easy|bib|1.11.0 vscode-intelephense-client|bme|1.4.1 htmltagwrap|bra|0.0.7 react-food-truck|bur|1.0.2 simple-react-snippets|bur|1.2.3 ember-module-snippets|can|1.3.121 vscode-exports-autocomplete|cap|0.5.4 vscode-standardjs-snippets|cap|0.8.12 emmet-jss|car|1.0.0 json-schema-to-json-template|Cha|1.0.2 vscode-standardjs|che|1.3.0 npm-intellisense|chr|1.3.0 path-intellisense|chr|2.2.1 vsc-ember-frost|cie|0.0.2 woocommerce|cla|1.1.0 wpcs-whitelist-flags|cla|1.1.0 vscode-es-beautifier|dai|1.1.0 jshint|dba|0.10.21 vscode-eslint|dba|2.1.5 vscode-html-css|ecm|0.2.3 vscode-npm-script|eg2|0.3.12 emberjs|emb|1.0.1 vscode-ember|emb|0.2.1 json-tools|eri|1.0.2 prettier-vscode|esb|5.1.0 vscode-optimize-images|fab|1.1.0 php-debug|fel|1.13.0 php-intellisense|fel|2.3.14 php-pack|fel|1.0.2 vsc-ember-cli|fel|0.3.3 vscode-php-cs-fixer|fte|0.3.0 sass-lint|gle|1.0.6 css2react|got|1.0.1 beautify|Hoo|1.5.0 ember-snippets|Hri|1.0.0 rest-client|hum|0.24.1 phpcs|ika|1.0.5 vscode-picture|Jak|1.0.0 search-node-modules|jas|1.3.0 ember-related-files|jos|1.5.0 wordpress-vscode-extensionpack|jpa|1.2.0 vscode-ember-test-runner|jxs|0.1.0 bem-expand|luk|0.1.4 json-to-ts|Mar|1.7.5 vscode-language-babel|mgm|0.0.27 code-beautifier|mic|2.3.3 prettify-json|moh|0.0.3 python|ms-|2020.6.89148 atom-keybindings|ms-|3.0.8 js-atom-grammar|ms-|0.1.14 vsliveshare|ms-|1.0.2354 debugger-for-chrome|msj|4.12.8 vscode-react-native|msj|0.16.0 php-docblocker|nei|2.1.0 vetur|oct|0.24.0 EmberES6Snippets|pha|2.3.3 heroku-command|pko|0.0.8 live-sass|rit|3.0.0 LiveServer|rit|5.6.1 sass-indented|rob|1.5.1 vscode-sass-format|sas|1.1.6 phpcs|she|1.0.8 html5-boilerplate|sid|1.0.3 sass-indented|syl|1.8.6 open-in-browser|tec|2.0.0 wordpress-snippet|tun|1.1.5 lorem-ipsum|Tyr|1.2.0 vscode-jss-snippets|vis|0.2.2 vscode-bemmet|vol|0.1.1 nodejs-extension-pack|wad|0.1.9 vscode-wakatime|Wak|4.0.0 vscode-import-cost|wix|2.12.0 wordpress-toolbox|wor|1.3.7 JavaScriptSnippets|xab|1.8.0 html-css-class-completion|Zig|1.19.0 (1 theme extensions excluded)
mjbvz commented 4 years ago

@cmcneese Do you have steps to reproduce this issue?

samuelnunoo commented 4 years ago

I got this error when trying to use Typescript with Vetur. I installed Vetur in VSCode then I activated typescript support in settings of Vetur.

[Error - 1:01:20 AM] Request textDocument/documentSymbol failed.
  Message: Request textDocument/documentSymbol failed with message: Debug Failure. Expected -635 >= 0
  Code: -32603 
c:\Users\Samuel\.vscode\extensions\octref.vetur-0.26.1\server\node_modules\typescript\lib\typescript.js:2251
            throw e;
            ^

Error: Debug Failure. Expected -635 >= 0
    at createFileDiagnostic (c:\Users\Samuel\.vscode\extensions\octref.vetur-0.26.1\server\node_modules\typescript\lib\typescript.js:17869:18)
mjbvz commented 3 years ago

Closing as not actionable without more information. If you see this again with VS Code 1.53+ and TypeScript 4.15+, please let us know

@samuelnunoo Please file your issue against the Vetur extension