Skip to content
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

TS Server fatal error: Debug Failure. False expression: Script kind should match provided ScriptKind:3 and sourceFile.scriptKind: 4, !entry: false #54381

Closed
Spookywy opened this issue May 24, 2023 · 2 comments · Fixed by #54401
Assignees

Comments

@Spookywy
Copy link

Spookywy commented May 24, 2023

Type: Bug

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

TypeScript Version: 5.1.1-rc

Steps to reproduce crash

The JS/TS language service crashes when using Github Copilot chat and scrolling in the chat history

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: syntax

Error: Debug Failure. False expression: Script kind should match provided ScriptKind:3 and sourceFile.scriptKind: 4, !entry: false
    at getDocumentRegistryEntry (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:133137:11)
    at Object.releaseDocumentWithKey (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:133234:19)
    at getOrCreateSourceFileByPath (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:141912:30)
    at Object.getOrCreateSourceFile (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:141896:14)
    at /Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:141828:42
    at Object.getSourceFileWithCache [as getSourceFile] (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:117906:24)
    at findSourceFileWorker (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:120299:23)
    at findSourceFile (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:120219:20)
    at /Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:120168:22
    at getSourceFileFromReferenceWorker (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:120152:69)
    at processSourceFile (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:120166:5)
    at processRootFile (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:119963:5)
    at /Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:118718:41
    at forEach (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:2325:22)
    at createProgram (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:118718:5)
    at synchronizeHostData (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:141852:15)
    at Object.getProgram (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:141924:5)
    at InferredProject2.updateGraphWorker (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:174484:41)
    at InferredProject2.updateGraph (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:174336:32)
    at _ProjectService.assignOrphanScriptInfoToInferredProject (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:176726:13)
    at _ProjectService.assignProjectToOpenedScriptInfo (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:178344:12)
    at /Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:178574:64
    at flatMap (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:2573:17)
    at _ProjectService.applyChangesInOpenFiles (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:178574:24)
    at updateOpen (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:179754:29)
    at /Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:182326:69
    at IpcIOSession.executeWithRequestId (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:182318:14)
    at IpcIOSession.executeCommand (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:182326:29)
    at IpcIOSession.onMessage (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:182368:51)
    at process.<anonymous> (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:183948:14)
    at process.emit (node:events:513:28)
    at emit (node:internal/child_process:958:14)
    at process.processTicksAndRejections (node:internal/process/task_queues:84:21)

VS Code version: Code - Insiders 1.79.0-insider (Universal) (f6be5461f8bc69013a605f5baea834651c6589fb, 2023-05-20T01:20:35.044Z)
OS version: Darwin arm64 22.5.0
Modes:

System Info
Item Value
CPUs Apple M2 Pro (12 x 24)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
Load (avg) 2, 2, 2
Memory (System) 32.00GB (4.88GB free)
Process Argv --crash-reporter-id 4589b8f1-e5a5-477a-b82a-5cf79f435501
Screen Reader no
VM 0%
Extensions (12)
Extension Author (truncated) Version
vscode-tailwindcss bra 0.9.11
vscode-eslint dba 2.4.1
gitlens eam 2023.5.2405
prettier-vscode esb 9.12.0
copilot-chat Git 0.1.2023052205
copilot-nightly Git 1.86.114
black-formatter ms- 2023.3.11241004
python ms- 2023.9.11371007
vscode-pylance ms- 2023.5.31
vsliveshare ms- 1.0.5864
vscode-icons vsc 12.4.0
pretty-ts-errors yoa 0.4.1

(1 theme extensions excluded)

A/B Experiments
vsliv695:30137379
vsins829:30139715
vsliv368cf:30146710
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
vstes627:30244334
vslsvsres303:30308271
pythontb:30258533
pythonptprofiler:30281269
vshan820:30294714
vscod805:30301674
bridge0708:30335490
bridge0723:30353136
cmake_vspar411:30581797
vsaa593cf:30376535
pythonvs932:30404738
cppdebug:30492333
vsclangdf:30492506
c4g48928:30535728
dsvsc012cf:30540253
pynewext54:30618038
pylantcb52:30590116
pyind779:30611226
pythonsymbol12:30651887
a9j8j154:30646983
showlangstatbar:30737417
pythonms35:30671666
0bg3d529:30680467
7ij38806:30687742
pythonfmttext:30716741
pythoncmvfstr:30726892
fixshowwlkth:30724385
showsbindicator:30724477
pythongtdpath:30726887

@Spookywy
Copy link
Author

The JS/TS language service crashes when using Github Copilot chat and scrolling in the chat history

@mjbvz mjbvz transferred this issue from microsoft/vscode May 24, 2023
@mjbvz
Copy link
Contributor

mjbvz commented May 24, 2023

Finally got a server log from the crash: tsserver.log

This only seems to happen on TS 5.1. I was never able to reproduce this in TS 5.0

In the logs, the cause of the crash appears to be ^/inmemory/model/4. This file is initially opened as tsx. This file is then closed:

Info 43   [15:22:41.456] request:
    {
      "seq": 7,
      "type": "request",
      "command": "updateOpen",
      "arguments": {
        "changedFiles": [],
        "closedFiles": [
          "^/inmemory/model/4"
        ],
        "openFiles": []
      }
    }

And then we reopen it as TS:

Info 46   [15:22:41.458] request:
    {
      "seq": 8,
      "type": "request",
      "command": "updateOpen",
      "arguments": {
        "changedFiles": [
          ... 
        ],
        "closedFiles": [],
        "openFiles": [
          {
            "file": "^/inmemory/model/4",
            "fileContent": "const numbers: number[] = [3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5];\nconst sortedNumbers: number[] = numbers.sort((a, b) => a - b);\nconsole.log(sortedNumbers);",
            "projectRootPath": "/Users/matb/projects/san",
            "scriptKindName": "TS"
          },
         ...
        ]
      }
    }

This is where the crash happens

@mjbvz mjbvz removed their assignment May 24, 2023
@sheetalkamat sheetalkamat self-assigned this May 25, 2023
typescript-bot pushed a commit to typescript-bot/TypeScript that referenced this issue May 25, 2023
Component commits:
8f0c69f Handle already released source files that dont match scriptKind Fixes microsoft#54381
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants