microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
164.34k stars 29.31k forks source link

TS Server fatal error: Cannot read property 'flags' of undefined #139352

Closed mcfly001 closed 2 years ago

mcfly001 commented 2 years ago

Issue Type: Bug

❗️❗️❗️ Please fill in the sections below to help us diagnose the issue ❗️❗️❗️

TypeScript Version: 4.5.2

Steps to reproduce crash 1. 2. 3.

TS Server Log ❗️Server logging disabled. To help us fix crashes like this, please enable logging by setting:

"typescript.tsserver.log": "verbose"

After enabling this setting, future crash reports will include the server log.

TS Server Error Stack Server: semantic

TypeError: Cannot read property 'flags' of undefined
    at getPropertyOfObjectType (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:57005:22)
    at getPropertyOfType (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:57665:24)
    at resolveESModuleSymbol (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:49811:54)
    at getTargetOfNamespaceImport (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:48996:28)
    at getTargetOfAliasDeclaration (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:49230:28)
    at resolveAlias (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:49275:30)
    at getSymbol (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:47833:38)
    at resolveNameHelper (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:48125:34)
    at resolveName (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:48108:20)
    at resolveEntityName (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:49447:42)
    at getTargetOfAliasLikeExpression (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:49204:29)
    at getTargetOfExportAssignment (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:49193:28)
    at getTargetOfAliasDeclaration (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:49240:28)
    at resolveAlias (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:49275:30)
    at resolveSymbol (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:49265:67)
    at resolveExternalModuleSymbol (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:49757:36)
    at getTargetOfNamespaceExportDeclaration (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:49180:28)
    at getTargetOfAliasDeclaration (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:49242:28)
    at resolveAlias (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:49275:30)
    at tryResolveAlias (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:49291:24)
    at getCandidateName (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:72927:33)
    at Object.getSpellingSuggestion (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:1873:33)
    at getSpellingSuggestionForName (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:72917:23)
    at /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:72858:24
    at resolveNameHelper (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:48416:30)
    at getSuggestedSymbolForNonexistentSymbol (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:72840:26)
    at resolveNameHelper (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:48438:42)
    at resolveName (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:48108:20)
    at getGlobalSymbol (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:58878:20)
    at getGlobalTypeSymbol (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:58860:20)
    at getGlobalType (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:58881:26)
    at initializeTypeChecker (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:85034:52)
    at Object.createTypeChecker (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:47390:9)
    at Object.getTypeChecker (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:114385:79)
    at synchronizeHostData (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:159863:21)
    at Object.getProgram (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:159984:13)
    at AutoImportProviderProject.Project.updateGraphWorker (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:164998:53)
    at AutoImportProviderProject.Project.updateGraph (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:164927:42)
    at AutoImportProviderProject.updateGraph (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:165772:70)
    at Object.updateProjectIfDirty (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:166409:45)
    at ConfiguredProject.Project.getPackageJsonAutoImportProvider (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:165547:32)
    at ConfiguredProject.Project.updateGraph (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:164965:26)
    at ConfiguredProject.updateGraph (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:165920:63)
    at ProjectService.createLoadAndUpdateConfiguredProject (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:167644:25)
    at ProjectService.assignProjectToOpenedScriptInfo (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:168727:44)
    at /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:169067:97
    at Object.flatMap (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:522:25)
    at ProjectService.applyChangesInOpenFiles (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:169067:41)
    at Session.handlers.ts.Map.ts.getEntries._a.<computed> (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:170225:46)
    at /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:172158:88
    at IOSession.Session.executeWithRequestId (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:172149:28)
    at IOSession.Session.executeCommand (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:172158:33)
    at IOSession.Session.onMessage (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:172184:35)
    at Interface.<anonymous> (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:174789:31)
    at Interface.emit (events.js:315:20)
    at Interface._onLine (readline.js:337:10)
    at Interface._normalWrite (readline.js:482:12)
    at Socket.ondata (readline.js:194:10)
    at Socket.emit (events.js:315:20)
    at addChunk (internal/streams/readable.js:309:12)
    at readableAddChunk (internal/streams/readable.js:284:9)
    at Socket.Readable.push (internal/streams/readable.js:223:10)
    at Pipe.onStreamRead (internal/stream_base_commons.js:188:23)

VS Code version: Code 1.63.1 (fe719cd3e5825bf14e14182fddeb88ee8daf044f, 2021-12-14T02:13:13.580Z) OS version: Darwin x64 21.1.0 Restricted Mode: No

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i5-6267U CPU @ 2.90GHz (4 x 2900)| |GPU Status|2d_canvas: enabled
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
skia_renderer: disabled_off_ok
video_decode: enabled
webgl: enabled
webgl2: enabled| |Load (avg)|30, 20, 12| |Memory (System)|16.00GB (0.10GB free)| |Process Argv|--crash-reporter-id d650fbfe-46d6-4c93-8a3f-9a6e9225efd6| |Screen Reader|no| |VM|0%|
Extensions (69) Extension|Author (truncated)|Version ---|---|--- aessoft-class-autocomplete|AES|0.1.0 markdown-toc|Ala|1.5.6 html-snippets|abu|0.2.1 Bookmarks|ale|13.2.2 tsl-problem-matcher|amo|0.5.0 language-maxscript|ate|1.25.0 color-info|bie|0.7.0 wechat-snippet|Cha|0.4.11 node-snippets|chr|1.3.3 npm-intellisense|chr|1.4.0 path-intellisense|chr|2.6.0 wxml-vscode|cny|0.1.2 vscode-weapp-api|cod|0.1.8 vscode-wxml|cod|0.1.9 bracket-pair-colorizer-2|Coe|0.2.2 vscode-markdownlint|Dav|0.45.0 vscode-eslint|dba|2.2.2 app-migrator|deb|0.0.6 githistory|don|0.6.19 es7-react-js-snippets|dsz|3.1.1 EditorConfig|Edi|0.16.4 vscode-npm-script|eg2|0.3.23 vscode-diff|fab|1.4.2 flow-for-vscode|flo|1.9.2 auto-close-tag|for|0.5.13 auto-rename-tag|for|0.1.9 leek-fund|gis|2.0.2 mdmath|goe|2.7.4 google-translate|han|1.2.6 githd|hui|2.2.4 iceworks-style-helper|ice|1.1.0 imgcook|img|0.1.4 gitlab-mr|jas|1.4.3 plantuml|jeb|2.16.1 docthis|joe|0.7.1 vscode-upsource|kas|1.6.1 vscode-codemetrics|kis|1.24.0 vscode-gutter-preview|kis|0.29.0 vscode-leetcode|Lee|0.18.0 translate|luo|2.1.0 template-string-converter|meg|0.5.5 vscode-html-format|moh|0.0.4 vscode-language-pack-zh-hans|MS-|1.63.3 vscode-typescript-tslint-plugin|ms-|1.3.3 debugger-for-chrome|msj|4.13.0 korofileheader|OBK|4.8.18 vetur|oct|0.35.0 miniapp-helper|ove|1.0.3 vuehelper|oys|0.1.0 vscode-css-peek|pra|4.2.0 vscode-wechat|qin|0.0.6 minapp-vscode|qiu|2.4.5 vscode-thunder-client|ran|1.9.1 LiveServer|rit|5.6.1 vue-vscode-snippets|sdr|2.2.1 wxapp-helper|sea|0.2.1 code-settings-sync|Sha|3.4.3 markdown-preview-enhanced|shd|0.6.1 rd-note|sta|0.1.3 open-in-browser|tec|2.0.0 react-redux-es6-snippets|tim|2.1.0 pdf|tom|1.2.0 vscode-icons|vsc|11.8.0 full-react-snippets|wal|1.4.2 vscode-js-console-utils|wht|0.7.0 vscode-import-cost|wix|2.15.0 JavaScriptSnippets|xab|1.8.0 ReactSnippets|xab|2.4.0 markdown-all-in-one|yzh|3.4.0
A/B Experiments ``` vsliv368cf:30146710 vsreu685:30147344 python383:30185418 vspor879:30202332 vspor708:30202333 vspor363:30204092 pythontb:30283811 pythonptprofiler:30281270 vsdfh931cf:30280410 vshan820:30294714 vstes263cf:30335440 pythondataviewer:30285071 vscod805cf:30301675 pythonvspyt200:30340761 binariesv615:30325510 bridge0708:30335490 bridge0723:30353136 vsaa593cf:30376535 pythonvs932:30410667 vscop804:30404766 vscop341:30404997 vsrem710:30405998 ```
georgii-nansen commented 2 years ago

The same thing happens on the latest version 1.63.2: https://github.com/microsoft/vscode/issues/139363