Skip to content

TS Server fatal error: Cannot read property 'get' of undefined #37938

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
yuenc opened this issue Apr 12, 2020 · 2 comments · Fixed by #38984
Closed

TS Server fatal error: Cannot read property 'get' of undefined #37938

yuenc opened this issue Apr 12, 2020 · 2 comments · Fixed by #38984
Assignees
Labels
Bug A bug in TypeScript Fix Available A PR has been opened for this issue Rescheduled This issue was previously scheduled to an earlier milestone VS Code Priority Critical issues that VS Code needs fixed in the current TypeScript milestone

Comments

@yuenc
Copy link

yuenc commented Apr 12, 2020

Issue Type: Bug

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

TypeError: Cannot read property 'get' of undefined
    at resolveModuleNamesReusingOldState (tsserver.js:98026:92)
    at processImportedModules (tsserver.js:99448:35)
    at findSourceFile (tsserver.js:99191:17)
    at tsserver.js:99020:85
    at getSourceFileFromReferenceWorker (tsserver.js:98987:34)
    at processSourceFile (tsserver.js:99020:13)
    at processRootFile (tsserver.js:98843:13)
    at tsserver.js:99418:21
    at Object.forEach (tsserver.js:167:30)
    at processLibReferenceDirectives (tsserver.js:99413:16)
    at findSourceFile (tsserver.js:99188:21)
    at tsserver.js:99020:85
    at getSourceFileFromReferenceWorker (tsserver.js:98987:34)
    at processSourceFile (tsserver.js:99020:13)
    at processRootFile (tsserver.js:98843:13)
    at tsserver.js:99418:21
    at Object.forEach (tsserver.js:167:30)
    at processLibReferenceDirectives (tsserver.js:99413:16)
    at findSourceFile (tsserver.js:99188:21)
    at tsserver.js:99020:85
    at getSourceFileFromReferenceWorker (tsserver.js:98987:34)
    at processSourceFile (tsserver.js:99020:13)
    at processRootFile (tsserver.js:98843:13)
    at tsserver.js:99418:21
    at Object.forEach (tsserver.js:167:30)
    at processLibReferenceDirectives (tsserver.js:99413:16)
    at findSourceFile (tsserver.js:99188:21)
    at tsserver.js:99020:85
    at getSourceFileFromReferenceWorker (tsserver.js:98987:34)
    at processSourceFile (tsserver.js:99020:13)
    at processRootFile (tsserver.js:98843:13)
    at tsserver.js:99418:21
    at Object.forEach (tsserver.js:167:30)
    at processLibReferenceDirectives (tsserver.js:99413:16)
    at findSourceFile (tsserver.js:99188:21)
    at tsserver.js:99020:85
    at getSourceFileFromReferenceWorker (tsserver.js:98987:34)
    at processSourceFile (tsserver.js:99020:13)
    at processRootFile (tsserver.js:98843:13)
    at tsserver.js:99418:21
    at Object.forEach (tsserver.js:167:30)
    at processLibReferenceDirectives (tsserver.js:99413:16)
    at findSourceFile (tsserver.js:99188:21)
    at tsserver.js:99020:85
    at getSourceFileFromReferenceWorker (tsserver.js:98987:34)
    at processSourceFile (tsserver.js:99020:13)
    at processRootFile (tsserver.js:98843:13)
    at tsserver.js:99418:21
    at Object.forEach (tsserver.js:167:30)
    at processLibReferenceDirectives (tsserver.js:99413:16)
    at findSourceFile (tsserver.js:99188:21)
    at tsserver.js:99020:85
    at getSourceFileFromReferenceWorker (tsserver.js:98987:34)
    at processSourceFile (tsserver.js:99020:13)
    at processRootFile (tsserver.js:98843:13)
    at tsserver.js:99418:21
    at Object.forEach (tsserver.js:167:30)
    at processLibReferenceDirectives (tsserver.js:99413:16)
    at findSourceFile (tsserver.js:99188:21)
    at tsserver.js:99020:85
    at getSourceFileFromReferenceWorker (tsserver.js:98987:34)
    at processSourceFile (tsserver.js:99020:13)
    at processRootFile (tsserver.js:98843:13)
    at tsserver.js:99418:21
    at Object.forEach (tsserver.js:167:30)
    at processLibReferenceDirectives (tsserver.js:99413:16)
    at findSourceFile (tsserver.js:99188:21)
    at tsserver.js:99020:85
    at getSourceFileFromReferenceWorker (tsserver.js:98987:34)
    at processSourceFile (tsserver.js:99020:13)
    at processRootFile (tsserver.js:98843:13)
    at tsserver.js:97809:60
    at Object.forEach (tsserver.js:167:30)
    at Object.createProgram (tsserver.js:97809:16)
    at synchronizeHostData (tsserver.js:135218:26)
    at Proxy.getProgram (tsserver.js:135310:13)
    at InferredProject.Project.updateGraphWorker (tsserver.js:139786:53)
    at InferredProject.Project.updateGraph (tsserver.js:139729:42)
    at updateProjectIfDirty (tsserver.js:141076:45)
    at Array.forEach (<anonymous>)
    at ProjectService.assignProjectToOpenedScriptInfo (tsserver.js:143127:41)
    at tsserver.js:143396:107
    at Object.mapDefined (tsserver.js:562:30)
    at ProjectService.applyChangesInOpenFiles (tsserver.js:143396:48)
    at Session.handlers.ts.createMapFromTemplate._a.<computed> (tsserver.js:144260:46)
    at tsserver.js:146003:88
    at IOSession.Session.executeWithRequestId (tsserver.js:145994:28)
    at IOSession.Session.executeCommand (tsserver.js:146003:33)
    at IOSession.Session.onMessage (tsserver.js:146027:35)
    at Interface.<anonymous> (tsserver.js:147342: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.44.0 (2aae1f26c72891c399f860409176fe435a154b13, 2020-04-07T23:31:18.860Z)
OS version: Windows_NT x64 10.0.18363

System Info
Item Value
CPUs Intel(R) Core(TM) i5-8400 CPU @ 2.80GHz (6 x 2808)
GPU Status 2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
protected_video_decode: enabled
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) undefined
Memory (System) 15.87GB (9.90GB free)
Process Argv
Screen Reader no
VM 0%
Extensions (9)
Extension Author (truncated) Version
vscode-deno axe 3.5.1
vscode-wasm dts 1.3.1
code-runner for 0.9.17
toml-formatter ice 0.0.3
vscode-wasm-syntax-lite jcm 0.3.0
rust-analyzer mat 0.2.117
remote-ssh ms- 0.51.0
remote-ssh-edit ms- 0.51.0
crates ser 0.4.9

(1 theme extensions excluded)

@mjbvz mjbvz transferred this issue from microsoft/vscode Apr 13, 2020
@mjbvz mjbvz removed their assignment Apr 13, 2020
@RyanCavanaugh RyanCavanaugh added the Bug A bug in TypeScript label Apr 17, 2020
@RyanCavanaugh RyanCavanaugh added this to the TypeScript 4.0 milestone Apr 17, 2020
@mjbvz mjbvz added the VS Code Priority Critical issues that VS Code needs fixed in the current TypeScript milestone label Apr 27, 2020
@mjbvz
Copy link
Contributor

mjbvz commented Apr 27, 2020

Also hit in microsoft/vscode#96191 with TypeScript 3.9.0-dev.20200425

@sheetalkamat
Copy link
Member

The fix for this crash is simple but i don't see why we should run into?

The crash happens at : https://github.com/microsoft/TypeScript/blob/master/src/compiler/program.ts#L1113 where it tries to get resolution from oldSourceFile.resolvedModules!.get(moduleName) but note that check before this verifies that file === oldSourceFile so module names havent changes to resolvedModules should exist.

@sheetalkamat sheetalkamat added the Fix Available A PR has been opened for this issue label Jun 8, 2020
typescript-bot pushed a commit to typescript-bot/TypeScript that referenced this issue Jul 7, 2020
Component commits:
a06e1c5 Remove non null assertion on oldSourceFile.resolvedModules Fixes microsoft#37938
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Fix Available A PR has been opened for this issue Rescheduled This issue was previously scheduled to an earlier milestone VS Code Priority Critical issues that VS Code needs fixed in the current TypeScript milestone
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants