Skip to content

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

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
abhaysingh-info opened this issue Sep 11, 2021 · 9 comments · Fixed by #46471
Closed

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

abhaysingh-info opened this issue Sep 11, 2021 · 9 comments · Fixed by #46471
Assignees
Labels
Needs Investigation This issue needs a team member to investigate its status.

Comments

@abhaysingh-info
Copy link

Issue Type: Bug

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

TypeScript Version: 4.5.0-dev.20210909

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 (/home/abhay/.vscode/extensions/ms-vscode.vscode-typescript-next-4.5.20210909/node_modules/typescript/lib/tsserver.js:56017:22)
    at getPropertyOfType (/home/abhay/.vscode/extensions/ms-vscode.vscode-typescript-next-4.5.20210909/node_modules/typescript/lib/tsserver.js:56667:24)
    at tryGetQualifiedNameAsValue (/home/abhay/.vscode/extensions/ms-vscode.vscode-typescript-next-4.5.20210909/node_modules/typescript/lib/tsserver.js:48544:26)
    at resolveEntityName (/home/abhay/.vscode/extensions/ms-vscode.vscode-typescript-next-4.5.20210909/node_modules/typescript/lib/tsserver.js:48601:133)
    at getSymbolOfPartOfRightHandSideOfImportEquals (/home/abhay/.vscode/extensions/ms-vscode.vscode-typescript-next-4.5.20210909/node_modules/typescript/lib/tsserver.js:48524:24)
    at getTargetOfImportEqualsDeclaration (/home/abhay/.vscode/extensions/ms-vscode.vscode-typescript-next-4.5.20210909/node_modules/typescript/lib/tsserver.js:47993:28)
    at getTargetOfAliasDeclaration (/home/abhay/.vscode/extensions/ms-vscode.vscode-typescript-next-4.5.20210909/node_modules/typescript/lib/tsserver.js:48343:28)
    at resolveAlias (/home/abhay/.vscode/extensions/ms-vscode.vscode-typescript-next-4.5.20210909/node_modules/typescript/lib/tsserver.js:48392:30)
    at resolveSymbol (/home/abhay/.vscode/extensions/ms-vscode.vscode-typescript-next-4.5.20210909/node_modules/typescript/lib/tsserver.js:48382:67)
    at mergeSymbol (/home/abhay/.vscode/extensions/ms-vscode.vscode-typescript-next-4.5.20210909/node_modules/typescript/lib/tsserver.js:46754:42)
    at /home/abhay/.vscode/extensions/ms-vscode.vscode-typescript-next-4.5.20210909/node_modules/typescript/lib/tsserver.js:46869:47
    at Map.forEach (<anonymous>)
    at mergeSymbolTable (/home/abhay/.vscode/extensions/ms-vscode.vscode-typescript-next-4.5.20210909/node_modules/typescript/lib/tsserver.js:46867:20)
    at mergeSymbol (/home/abhay/.vscode/extensions/ms-vscode.vscode-typescript-next-4.5.20210909/node_modules/typescript/lib/tsserver.js:46778:21)
    at /home/abhay/.vscode/extensions/ms-vscode.vscode-typescript-next-4.5.20210909/node_modules/typescript/lib/tsserver.js:46869:47
    at Map.forEach (<anonymous>)
    at mergeSymbolTable (/home/abhay/.vscode/extensions/ms-vscode.vscode-typescript-next-4.5.20210909/node_modules/typescript/lib/tsserver.js:46867:20)
    at initializeTypeChecker (/home/abhay/.vscode/extensions/ms-vscode.vscode-typescript-next-4.5.20210909/node_modules/typescript/lib/tsserver.js:83489:21)
    at Object.createTypeChecker (/home/abhay/.vscode/extensions/ms-vscode.vscode-typescript-next-4.5.20210909/node_modules/typescript/lib/tsserver.js:46531:9)
    at Object.getTypeChecker (/home/abhay/.vscode/extensions/ms-vscode.vscode-typescript-next-4.5.20210909/node_modules/typescript/lib/tsserver.js:112609:79)
    at synchronizeHostData (/home/abhay/.vscode/extensions/ms-vscode.vscode-typescript-next-4.5.20210909/node_modules/typescript/lib/tsserver.js:157222:21)
    at Object.getProgram (/home/abhay/.vscode/extensions/ms-vscode.vscode-typescript-next-4.5.20210909/node_modules/typescript/lib/tsserver.js:157343:13)
    at AutoImportProviderProject.Project.updateGraphWorker (/home/abhay/.vscode/extensions/ms-vscode.vscode-typescript-next-4.5.20210909/node_modules/typescript/lib/tsserver.js:162350:53)
    at AutoImportProviderProject.Project.updateGraph (/home/abhay/.vscode/extensions/ms-vscode.vscode-typescript-next-4.5.20210909/node_modules/typescript/lib/tsserver.js:162279:42)
    at AutoImportProviderProject.updateGraph (/home/abhay/.vscode/extensions/ms-vscode.vscode-typescript-next-4.5.20210909/node_modules/typescript/lib/tsserver.js:163124:70)
    at Object.updateProjectIfDirty (/home/abhay/.vscode/extensions/ms-vscode.vscode-typescript-next-4.5.20210909/node_modules/typescript/lib/tsserver.js:163761:45)
    at InferredProject.Project.getPackageJsonAutoImportProvider (/home/abhay/.vscode/extensions/ms-vscode.vscode-typescript-next-4.5.20210909/node_modules/typescript/lib/tsserver.js:162899:32)
    at InferredProject.Project.updateGraph (/home/abhay/.vscode/extensions/ms-vscode.vscode-typescript-next-4.5.20210909/node_modules/typescript/lib/tsserver.js:162317:26)
    at ProjectService.assignOrphanScriptInfoToInferredProject (/home/abhay/.vscode/extensions/ms-vscode.vscode-typescript-next-4.5.20210909/node_modules/typescript/lib/tsserver.js:164456:25)
    at ProjectService.assignProjectToOpenedScriptInfo (/home/abhay/.vscode/extensions/ms-vscode.vscode-typescript-next-4.5.20210909/node_modules/typescript/lib/tsserver.js:166145:26)
    at /home/abhay/.vscode/extensions/ms-vscode.vscode-typescript-next-4.5.20210909/node_modules/typescript/lib/tsserver.js:166419:97
    at Object.flatMap (/home/abhay/.vscode/extensions/ms-vscode.vscode-typescript-next-4.5.20210909/node_modules/typescript/lib/tsserver.js:519:25)
    at ProjectService.applyChangesInOpenFiles (/home/abhay/.vscode/extensions/ms-vscode.vscode-typescript-next-4.5.20210909/node_modules/typescript/lib/tsserver.js:166419:41)
    at Session.handlers.ts.Map.ts.getEntries._a.<computed> (/home/abhay/.vscode/extensions/ms-vscode.vscode-typescript-next-4.5.20210909/node_modules/typescript/lib/tsserver.js:167577:46)
    at /home/abhay/.vscode/extensions/ms-vscode.vscode-typescript-next-4.5.20210909/node_modules/typescript/lib/tsserver.js:169508:88
    at IOSession.Session.executeWithRequestId (/home/abhay/.vscode/extensions/ms-vscode.vscode-typescript-next-4.5.20210909/node_modules/typescript/lib/tsserver.js:169499:28)
    at IOSession.Session.executeCommand (/home/abhay/.vscode/extensions/ms-vscode.vscode-typescript-next-4.5.20210909/node_modules/typescript/lib/tsserver.js:169508:33)
    at IOSession.Session.onMessage (/home/abhay/.vscode/extensions/ms-vscode.vscode-typescript-next-4.5.20210909/node_modules/typescript/lib/tsserver.js:169534:35)
    at Interface.<anonymous> (/home/abhay/.vscode/extensions/ms-vscode.vscode-typescript-next-4.5.20210909/node_modules/typescript/lib/tsserver.js:172139: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.60.0 (e7d7e9a9348e6a8cc8c03f877d39cb72e5dfb1ff, 2021-09-01T10:43:02.136Z)
OS version: Linux x64 5.13.13-200.fc34.x86_64
Restricted Mode: No

System Info
Item Value
CPUs AMD E2-7110 APU with AMD Radeon R2 Graphics (4 x 1796)
GPU Status 2d_canvas: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
opengl: enabled_on
rasterization: disabled_software
skia_renderer: enabled_on
video_decode: disabled_software
vulkan: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) 8, 9, 5
Memory (System) 6.74GB (0.71GB free)
Process Argv . --crash-reporter-id f1e77813-3779-49b2-8065-5b342af30d54
Screen Reader no
VM 0%
DESKTOP_SESSION gnome-xorg
XDG_CURRENT_DESKTOP GNOME
XDG_SESSION_DESKTOP gnome-xorg
XDG_SESSION_TYPE x11
Extensions (8)
Extension Author (truncated) Version
vscode-eslint dba 2.1.25
prettier-vscode esb 8.1.0
todo-tree Gru 0.0.214
vscode-typescript-next ms- 4.5.20210910
material-icon-theme PKi 4.10.0
material-product-icons PKi 1.1.1
vscode-thunder-client ran 1.9.1
LiveServer rit 5.6.1

(1 theme extensions excluded)

A/B Experiments
vsliv368cf:30146710
vsreu685:30147344
python383:30185418
pythonvspyt602:30300191
vspor879:30202332
vspor708:30202333
vspor363:30204092
pythonvspyt639:30300192
pythontb:30283811
pythonptprofiler:30281270
vsdfh931cf:30280410
vshan820:30294714
vstes263:30335439
pythondataviewer:30285071
pythonvsuse255:30340121
vscod805cf:30301675
pythonvspyt200:30340761
vscextlangct:30333562
binariesv615:30325510
vsccppwtct:30364498
pythonvssor306:30344512
bridge0708:30335490
pygetstartedt2:30360495
bridge0723:30353136
pythonrunftest32cf:30365367
pythonf5test824cf:30361778
javagetstartedc:30364665
pythonvspyt187:30365361
pydsgst2:30361792
vscus224:30358039
vssid140cf:30363604

@mjbvz mjbvz transferred this issue from microsoft/vscode Sep 14, 2021
@andrewbranch
Copy link
Member

@abhaysocialised, can you share your list of package.json dependencies for the project where this crash happened?

@andrewbranch andrewbranch added the Needs More Info The issue still hasn't been fully clarified label Sep 14, 2021
@mjbvz mjbvz removed their assignment Sep 15, 2021
@abhaysingh-info
Copy link
Author

abhaysingh-info commented Sep 16, 2021

@andrewbranch package.json

{
"name": "server",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "nodemon index.js --trace-warnings",
"test": "echo "Error: no test specified" && exit 1"
},
"author": "Abhay Singh",
"license": "ISC",
"dependencies": {
"compression": "^1.7.4",
"cors": "^2.8.5",
"dotenv": "^10.0.0",
"express": "^4.17.1",
"ftp": "^0.3.10",
"jsonwebtoken": "^8.5.1",
"mongoose": "^5.13.3",
"multer": "^1.4.2",
"sharp": "^0.28.3",
"uuid": "^8.3.2"
}
}

@abhaysingh-info
Copy link
Author

I don't know how to reproduce crash because this problem is with my this project only and this is my settings.json file

{
"explorer.confirmDragAndDrop": false,
"javascript.updateImportsOnFileMove.enabled": "always",
"workbench.iconTheme": "material-icon-theme",
"emmet.includeLanguages": {
"javascript": "javascriptreact"
},
"explorer.confirmDelete": false,
"workbench.editor.untitled.hint": "hidden",
"git.autofetch": true,
"editor.formatOnSave": true,
"prettier.useTabs": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"git.enableSmartCommit": true,
"gitlens.defaultDateFormat": "DD MMMM YYYY",
"gitlens.defaultDateShortFormat": "DD/MM/YYYY",
"gitlens.defaultTimeFormat": "HH:MM a",
"workbench.startupEditor": "none",
"editor.linkedEditing": true,
"prettier.useEditorConfig": false,
"workbench.editorAssociations": {
"*.ipynb": "jupyter.notebook.ipynb"
},
"editor.codeActionsOnSave": {
"source.fixAll.tslint": true
},
"files.associations": {
"tslint.json": "jsonc"
},
"prettier.trailingComma": "all",
"prettier.tabWidth": 2,
"prettier.semi": false,
"prettier.singleQuote": true,
"diffEditor.wordWrap": "on",
"editor.wordWrap": "on",
"security.workspace.trust.untrustedFiles": "open",
"tabnine.experimentalAutoImports": true,
"typescript.updateImportsOnFileMove.enabled": "always",
"jshint.options": {
"esversion": 8
},
"go.toolsManagement.autoUpdate": true,
"workbench.colorTheme": "Community Material Theme Ocean High Contrast",
"settingsSync.ignoredExtensions": [

]

}

@andrewbranch andrewbranch self-assigned this Sep 16, 2021
@andrewbranch andrewbranch added Needs Investigation This issue needs a team member to investigate its status. and removed Needs More Info The issue still hasn't been fully clarified labels Sep 16, 2021
@andrewbranch andrewbranch added this to the TypeScript 4.5.1 milestone Sep 16, 2021
@abhaysingh-info
Copy link
Author

TypeScript Server Error (4.5.0-dev.20210915) Cannot read property 'flags' of undefined TypeError: Cannot read property 'flags' of undefined at getPropertyOfObjectType (/home/abhay/.vscode/extensions/ms-vscode.vscode-typescript-next-4.5.20210915/node_modules/typescript/lib/tsserver.js:56030:22) at getPropertyOfType (/home/abhay/.vscode/extensions/ms-vscode.vscode-typescript-next-4.5.20210915/node_modules/typescript/lib/tsserver.js:56680:24) at tryGetQualifiedNameAsValue (/home/abhay/.vscode/extensions/ms-vscode.vscode-typescript-next-4.5.20210915/node_modules/typescript/lib/tsserver.js:48557:26) at resolveEntityName (/home/abhay/.vscode/extensions/ms-vscode.vscode-typescript-next-4.5.20210915/node_modules/typescript/lib/tsserver.js:48614:133) at getSymbolOfPartOfRightHandSideOfImportEquals (/home/abhay/.vscode/extensions/ms-vscode.vscode-typescript-next-4.5.20210915/node_modules/typescript/lib/tsserver.js:48537:24) at getTargetOfImportEqualsDeclaration (/home/abhay/.vscode/extensions/ms-vscode.vscode-typescript-next-4.5.20210915/node_modules/typescript/lib/tsserver.js:48006:28) at getTargetOfAliasDeclaration (/home/abhay/.vscode/extensions/ms-vscode.vscode-typescript-next-4.5.20210915/node_modules/typescript/lib/tsserver.js:48356:28) at resolveAlias (/home/abhay/.vscode/extensions/ms-vscode.vscode-typescript-next-4.5.20210915/node_modules/typescript/lib/tsserver.js:48405:30) at resolveSymbol (/home/abhay/.vscode/extensions/ms-vscode.vscode-typescript-next-4.5.20210915/node_modules/typescript/lib/tsserver.js:48395:67) at mergeSymbol (/home/abhay/.vscode/extensions/ms-vscode.vscode-typescript-next-4.5.20210915/node_modules/typescript/lib/tsserver.js:46767:42) at /home/abhay/.vscode/extensions/ms-vscode.vscode-typescript-next-4.5.20210915/node_modules/typescript/lib/tsserver.js:46882:47 at Map.forEach () at mergeSymbolTable (/home/abhay/.vscode/extensions/ms-vscode.vscode-typescript-next-4.5.20210915/node_modules/typescript/lib/tsserver.js:46880:20) at mergeSymbol (/home/abhay/.vscode/extensions/ms-vscode.vscode-typescript-next-4.5.20210915/node_modules/typescript/lib/tsserver.js:46791:21) at /home/abhay/.vscode/extensions/ms-vscode.vscode-typescript-next-4.5.20210915/node_modules/typescript/lib/tsserver.js:46882:47 at Map.forEach () at mergeSymbolTable (/home/abhay/.vscode/extensions/ms-vscode.vscode-typescript-next-4.5.20210915/node_modules/typescript/lib/tsserver.js:46880:20) at initializeTypeChecker (/home/abhay/.vscode/extensions/ms-vscode.vscode-typescript-next-4.5.20210915/node_modules/typescript/lib/tsserver.js:83596:21) at Object.createTypeChecker (/home/abhay/.vscode/extensions/ms-vscode.vscode-typescript-next-4.5.20210915/node_modules/typescript/lib/tsserver.js:46544:9) at Object.getTypeChecker (/home/abhay/.vscode/extensions/ms-vscode.vscode-typescript-next-4.5.20210915/node_modules/typescript/lib/tsserver.js:112716:79) at synchronizeHostData (/home/abhay/.vscode/extensions/ms-vscode.vscode-typescript-next-4.5.20210915/node_modules/typescript/lib/tsserver.js:157329:21) at Object.getProgram (/home/abhay/.vscode/extensions/ms-vscode.vscode-typescript-next-4.5.20210915/node_modules/typescript/lib/tsserver.js:157450:13) at AutoImportProviderProject.Project.updateGraphWorker (/home/abhay/.vscode/extensions/ms-vscode.vscode-typescript-next-4.5.20210915/node_modules/typescript/lib/tsserver.js:162457:53) at AutoImportProviderProject.Project.updateGraph (/home/abhay/.vscode/extensions/ms-vscode.vscode-typescript-next-4.5.20210915/node_modules/typescript/lib/tsserver.js:162386:42) at AutoImportProviderProject.updateGraph (/home/abhay/.vscode/extensions/ms-vscode.vscode-typescript-next-4.5.20210915/node_modules/typescript/lib/tsserver.js:163231:70) at Object.updateProjectIfDirty (/home/abhay/.vscode/extensions/ms-vscode.vscode-typescript-next-4.5.20210915/node_modules/typescript/lib/tsserver.js:163868:45) at InferredProject.Project.getPackageJsonAutoImportProvider (/home/abhay/.vscode/extensions/ms-vscode.vscode-typescript-next-4.5.20210915/node_modules/typescript/lib/tsserver.js:163006:32) at InferredProject.Project.updateGraph (/home/abhay/.vscode/extensions/ms-vscode.vscode-typescript-next-4.5.20210915/node_modules/typescript/lib/tsserver.js:162424:26) at ProjectService.assignOrphanScriptInfoToInferredProject (/home/abhay/.vscode/extensions/ms-vscode.vscode-typescript-next-4.5.20210915/node_modules/typescript/lib/tsserver.js:164563:25) at ProjectService.assignProjectToOpenedScriptInfo (/home/abhay/.vscode/extensions/ms-vscode.vscode-typescript-next-4.5.20210915/node_modules/typescript/lib/tsserver.js:166252:26) at /home/abhay/.vscode/extensions/ms-vscode.vscode-typescript-next-4.5.20210915/node_modules/typescript/lib/tsserver.js:166526:97 at Object.flatMap (/home/abhay/.vscode/extensions/ms-vscode.vscode-typescript-next-4.5.20210915/node_modules/typescript/lib/tsserver.js:519:25) at ProjectService.applyChangesInOpenFiles (/home/abhay/.vscode/extensions/ms-vscode.vscode-typescript-next-4.5.20210915/node_modules/typescript/lib/tsserver.js:166526:41) at Session.handlers.ts.Map.ts.getEntries._a. (/home/abhay/.vscode/extensions/ms-vscode.vscode-typescript-next-4.5.20210915/node_modules/typescript/lib/tsserver.js:167684:46) at /home/abhay/.vscode/extensions/ms-vscode.vscode-typescript-next-4.5.20210915/node_modules/typescript/lib/tsserver.js:169615:88 at IOSession.Session.executeWithRequestId (/home/abhay/.vscode/extensions/ms-vscode.vscode-typescript-next-4.5.20210915/node_modules/typescript/lib/tsserver.js:169606:28) at IOSession.Session.executeCommand (/home/abhay/.vscode/extensions/ms-vscode.vscode-typescript-next-4.5.20210915/node_modules/typescript/lib/tsserver.js:169615:33) at IOSession.Session.onMessage (/home/abhay/.vscode/extensions/ms-vscode.vscode-typescript-next-4.5.20210915/node_modules/typescript/lib/tsserver.js:169641:35) at Interface. (/home/abhay/.vscode/extensions/ms-vscode.vscode-typescript-next-4.5.20210915/node_modules/typescript/lib/tsserver.js:172246: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)

@abhaysingh-info
Copy link
Author

abhaysingh-info commented Sep 18, 2021

this is error that is in runtime status. I've copied whole errors but there are more in logs for the same error. i.e all errors in Log are same...

@andrewbranch
Copy link
Member

initializeTypeChecker is kicking off work via mergeSymbolTable that ends up pulling on globalObjectType before it's initialized (later in initializeTypeChecker) 😱

@andrewbranch
Copy link
Member

@abhaysocialised I still can’t reproduce this—do you have a repo you can share where this is happening?

@andrewbranch
Copy link
Member

Update—got a repro.

@bengry
Copy link

bengry commented Nov 23, 2021

I'm still seeing this in 4.5.2. Was this merged to that version (I assume so, but wanted to verify).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Investigation This issue needs a team member to investigate its status.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants