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. #60243

Open
MerryCello opened this issue Oct 14, 2024 · 19 comments · May be fixed by #60630 or #60910
Open

TS Server fatal error: Debug Failure. #60243

MerryCello opened this issue Oct 14, 2024 · 19 comments · May be fixed by #60630 or #60910
Assignees
Labels
Bug A bug in TypeScript Fix Available A PR has been opened for this issue

Comments

@MerryCello
Copy link

Type: Bug

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

TypeScript Version: 5.6.2

Steps to reproduce crash
I didn't do anything difference as last time I opened VS Code and now it's crashing

  1. Update to latest VS code (1.94.0)
  2. Open VS code to a TS project
  3. Make changes to some TS files

After regular usage, the TS server will just freeze up (infinite loading & no editing helpers).

According to issue Initellisense infinite loading microsoft/vscode#52691, I should be able to fix this by increasing TS server's memory, but I shouldn't have to do that...

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.

VS Code version: Code 1.94.0 (Universal) (d78a74bcdfad14d5d3b1b782f87255d802b57511, 2024-10-02T13:08:12.626Z)
OS version: Darwin arm64 23.6.0
Modes:

System Info
Item Value
CPUs Apple M1 Pro (10 x 2400)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) 11, 13, 12
Memory (System) 32.00GB (0.24GB free)
Process Argv --crash-reporter-id cb0287d2-a42d-4774-a99d-41e7456b17dd
Screen Reader no
VM 0%
Extensions (14)
Extension Author (truncated) Version
better-comments aar 3.0.2
vscode-sql-formatter adp 1.4.4
githistory don 0.6.20
gitlens eam 15.6.0
prettier-vscode esb 11.0.0
copilot Git 1.238.0
copilot-chat Git 0.21.1
inline-parameters lia 0.2.1
live-server ms- 0.4.15
vsliveshare ms- 1.0.5941
sonarlint-vscode Son 4.11.1
even-better-toml tam 0.19.2
vscode-gradle vsc 3.16.4
pretty-ts-errors Yoa 0.6.0
A/B Experiments
vsliv368cf:30146710
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscod805cf:30301675
binariesv615:30325510
vsaa593cf:30376535
py29gd2263:31024239
c4g48928:30535728
azure-dev_surveyone:30548225
962ge761:30959799
pythongtdpath:30769146
pythonnoceb:30805159
asynctok:30898717
pythonmypyd1:30879173
h48ei257:31000450
pythontbext0:30879054
accentitlementsc:30995553
cppperfnew:31000557
dsvsc020:30976470
pythonait:31006305
dsvsc021:30996838
da93g388:31013173
a69g1124:31058053
dvdeprecation:31068756
dwnewjupytercf:31046870
newcmakeconfigv2:31071590
impr_priority:31102340
nativerepl2:31139839
refactort:31108082
pythonrstrctxt:31112756
wkspc-onlycs-t:31132770
wkspc-ranged-t:31151552
cf971741:31144450
autoexpandse:31146404
iacca1:31156133
notype1:31157159
5fd0e150:31155592
icondisabled:31158250

Copy link

Thanks for creating this issue! It looks like you may be using an old version of VS Code, the latest stable release is 1.94.2. Please try upgrading to the latest version and checking whether this issue remains.

Happy Coding!

@MerryCello
Copy link
Author

MerryCello commented Oct 15, 2024

Hi, I just updated to the version mentioned and I am still facing this issue. To get Typescript to work again, I am forced to close VS Code and reopen it. Restarting the TS server does nothing.

Version: 1.94.2 (Universal)
Commit: 384ff7382de624fb94dbaf6da11977bba1ecd427
Date: 2024-10-09T16:08:44.566Z
Electron: 30.5.1
ElectronBuildId: 10262041
Chromium: 124.0.6367.243
Node.js: 20.16.0
V8: 12.4.254.20-electron.0
OS: Darwin arm64 23.6.0

@mjbvz
Copy link
Contributor

mjbvz commented Oct 15, 2024

Please try collecting the TS Server log from the crashed instance:

  1. Set "typescript.tsserver.log": "verbose"

  2. Restart VS Code and reproduce the problem

  3. Open the TypeScript section of the output panel

  4. At the very top, find the first line that prints to path to the semantic error log file. It should look something like:

    [Info  - 19:54:59.247] <semantic> Log file: /Users/matb/Library/Application Support/Code - Insiders/logs/20200213T104930/exthost55/vscode.typescript-language-features/tsserver-log-ZT2zau/tsserver.log
    

    That file contains the typescript logs.

Look through that log file for the first error or stack trace you see. If you can share the log, I can also take a look to see if anything stands out

⚠️Warning: The TypeScript log may include information from your workspace, including file paths and source code. If you have any concerns about posting this publicly on Github, just let me know and we can arrange something else. On our side, we only use these logs to investigate issues like this

@MerryCello
Copy link
Author

Here's the error logs I found. I hope this helps

Typescript Output

2024-10-16 08:59:54.143 [info] <semantic> Log file: /path/to/Application Support/Code/logs/20241015T155211/window1/exthost/vscode.typescript-language-features/tsserver-log-BbVVPO/tsserver.log
2024-10-16 08:59:54.143 [info] <semantic> Forking...
2024-10-16 08:59:54.143 [info] <semantic> Starting...
2024-10-16 09:04:50.790 [info] Killing TS Server
2024-10-16 09:04:50.899 [error] TSServer exited. Code: null. Signal: SIGTERM

tsserver.log

Err 7256  [08:59:54.035] Exception on executing command {
  "seq": 108,
  "type": "request",
  "command": "updateOpen",
  "arguments": {
    "changedFiles": [],
    "closedFiles": [
      "/path/to/project/root/__tests__/__mocks__/package.js"
    ],
    "openFiles": [
      {
        "file": "/path/to/project/root/packages/package-name/__tests__/utils.ts",
        "fileContent": "FILE CONTENT OMITTED",
        "projectRootPath": "/path/to/project/root",
        "scriptKindName": "TS"
      }
    ]
  }
}:

    Debug Failure.

    Error: Debug Failure.
        at stopWatchFailedLookupLocationOfResolution (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:130844:11)
        at resolveNamesWithLocalCache (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:130440:13)
        at Object.resolveModuleNameLiterals (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:130521:12)
        at InferredProject2.resolveModuleNameLiterals (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:183583:33)
        at resolveModuleNamesWorker (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:125213:20)
        at resolveNamesReusingOldState (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:125355:14)
        at resolveModuleNamesReusingOldState (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:125311:12)
        at processImportedModules (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:126826:118)
        at findSourceFileWorker (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:126601:7)
        at findSourceFile (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:126452:20)
        at processImportedModules (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:126852:11)
        at findSourceFileWorker (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:126601:7)
        at findSourceFile (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:126452:20)
        at processImportedModules (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:126852:11)
        at findSourceFileWorker (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:126601:7)
        at findSourceFile (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:126452:20)
        at /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:126401:22
        at getSourceFileFromReferenceWorker (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:126372:26)
        at processSourceFile (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:126399:5)
        at processRootFile (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:126191:5)
        at /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:124902:41
        at forEach (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:2282:22)
        at createProgram (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:124902:5)
        at synchronizeHostDataWorker (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:149871:15)
        at synchronizeHostData (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:149767:7)
        at Object.getProgram (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:149948:5)
        at InferredProject2.updateGraphWorker (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:184301:41)
        at InferredProject2.updateGraph (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:184137:32)
        at _ProjectService.assignOrphanScriptInfoToInferredProject (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:186805:13)
        at _ProjectService.assignProjectToOpenedScriptInfo (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:188397:12)
        at /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:188786:25
        at Array.forEach (<anonymous>)
        at _ProjectService.applyChangesInOpenFiles (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:188784:56)
        at updateOpen (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:189983:29)
        at /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:192651:15
        at IpcIOSession.executeWithRequestId (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:192640:14)
        at IpcIOSession.executeCommand (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:192649:29)
        at IpcIOSession.onMessage (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:192697:68)
        at process.<anonymous> (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:525:14)
        at process.emit (node:events:519:28)
        at emit (node:internal/child_process:951:14)
        at process.processTicksAndRejections (node:internal/process/task_queues:83:21)

From another tsserver.log

Err 5120  [09:04:50.787] Exception on executing command {
  "seq": 8,
  "type": "request",
  "command": "updateOpen",
  "arguments": {
    "changedFiles": [],
    "closedFiles": [],
    "openFiles": [
      {
        "file": "/path/to/project/root/packages/package-name/src/components/component/index.tsx",
        "fileContent": "FILE CONTENT OMITTED",
        "projectRootPath": "/path/to/project/root",
        "scriptKindName": "TSX"
      }
    ]
  }
}:

    Debug Failure.

    Error: Debug Failure.
        at stopWatchFailedLookupLocationOfResolution (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:130844:11)
        at /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:130890:25
        at /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:43862:16
        at Map.forEach (<anonymous>)
        at Object.forEach (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:43860:25)
        at removeResolutionsOfFileFromCache (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:130889:19)
        at Object.removeResolutionsOfFile (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:130908:5)
        at _AutoImportProviderProject.detachScriptInfoFromProject (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:184439:30)
        at _AutoImportProviderProject.onReleaseOldSourceFile (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:184122:12)
        at Object.onReleaseOldSourceFile (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:149916:66)
        at createProgram (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:124974:14)
        at synchronizeHostDataWorker (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:149871:15)
        at synchronizeHostData (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:149767:7)
        at Object.getProgram (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:149948:5)
        at _AutoImportProviderProject.updateGraphWorker (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:184301:41)
        at _AutoImportProviderProject.updateGraph (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:184137:32)
        at _AutoImportProviderProject.updateGraph (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:185276:37)
        at updateProjectIfDirty (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:185914:36)
        at Array.forEach (<anonymous>)
        at _ProjectService.assignProjectToOpenedScriptInfo (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:188386:29)
        at /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:188786:25
        at Array.forEach (<anonymous>)
        at _ProjectService.applyChangesInOpenFiles (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:188784:56)
        at updateOpen (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:189983:29)
        at /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:192651:15
        at IpcIOSession.executeWithRequestId (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:192640:14)
        at IpcIOSession.executeCommand (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:192649:29)
        at IpcIOSession.onMessage (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/typescript.js:192697:68)
        at process.<anonymous> (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:525:14)
        at process.emit (node:events:519:28)
        at emit (node:internal/child_process:951:14)
        at process.processTicksAndRejections (node:internal/process/task_queues:83:21)

@mjbvz mjbvz transferred this issue from microsoft/vscode Oct 16, 2024
@mjbvz mjbvz removed their assignment Oct 16, 2024
@RyanCavanaugh RyanCavanaugh added the Bug A bug in TypeScript label Oct 16, 2024
@andrewbranch
Copy link
Member

@MerryCello can you share a full TS Server log (not just the error stack)? Are you able to reproduce this consistently with specific steps, or does it seem to stop working randomly?

@MerryCello
Copy link
Author

MerryCello commented Oct 18, 2024 via email

@mbtools
Copy link

mbtools commented Oct 21, 2024

TypeScript.log

tsserver.zip

I was able to capture a full log (v1.94.2). This was with a fairly big open-source repo. Although it happened several times, I'm not able to reproduce it. If I find a way, I will post it here.

@pbomb
Copy link

pbomb commented Oct 22, 2024

I've also been struggling with these errors for the past couple weeks. I'm also not sure what triggers it but it typically happens to me about every 10 - 30 minutes.

@jerry2013
Copy link

This error is making vscode pretty un-usable now.

@jerry2013
Copy link

with the current vscode version: 1.95.3, I grabbed the resolution in stopWatchFailedLookupLocationOfResolution and it doesn't have resolution.files which triggers the throw.

maybe stopWatchFailedLookupLocationOfResolution ran twice?

in any case, I did if (!resolution.files) return and everything works fine. Why do we need Debug.checkDefined here? the next few lines would set it to undefined anyway.

{
  "resolvedModule": {
    "resolvedFileName": "/app/node_modules/moment/ts3.1-typings/moment.d.ts",
    "extension": ".d.ts",
    "isExternalLibraryImport": true,
    "packageId": {
      "name": "moment",
      "subModuleName": "ts3.1-typings/moment.d.ts",
      "version": "2.29.4"
    },
    "resolvedUsingTsExtension": false
  },
  "failedLookupLocations": [
    "/app/node_modules/moment-timezone/node_modules/moment/package.json",
    "/app/node_modules/moment-timezone/node_modules/moment.ts",
    "/app/node_modules/moment-timezone/node_modules/moment.tsx",
    "/app/node_modules/moment-timezone/node_modules/moment.d.ts",
    "/app/node_modules/moment-timezone/node_modules/moment/index.ts",
    "/app/node_modules/moment-timezone/node_modules/moment/index.tsx",
    "/app/node_modules/moment-timezone/node_modules/moment/index.d.ts",
    "/app/node_modules/moment-timezone/node_modules/@types/moment/package.json",
    "/app/node_modules/moment-timezone/node_modules/@types/moment.d.ts",
    "/app/node_modules/moment-timezone/node_modules/@types/moment/index.d.ts",
    "/app/node_modules/moment.ts",
    "/app/node_modules/moment.tsx",
    "/app/node_modules/moment.d.ts"
  ],
  "affectingLocations": [
    "/app/node_modules/moment-timezone/package.json",
    "/app/node_modules/moment/package.json",
    "/app/node_modules/moment-timezone/package.json"
  ]
}

@Andarist
Copy link
Contributor

It would be good to know if #60039 resolves this issue. Could any of you test it out using a build from that branch?

@jerry2013
Copy link

It would be good to know if #60039 resolves this issue. Could any of you test it out using a build from that branch?

I can try - but ... Is there an easy way to install that branch to be used with vscode?

@Andarist
Copy link
Contributor

Andarist commented Dec 3, 2024

@jerry2013 a fresh PR build is available here: #60039 (comment)

@andrewbranch
Copy link
Member

I found a repro for this in the TypeScript repo.

  1. Open checker.ts
  2. Find All node16,nodenext in tests/cases, replace with node16,node18,nodenext

@andrewbranch
Copy link
Member

#60039 does not fix it, so I’ll investigate

@andrewbranch
Copy link
Member

@MerryCello @jerry2013 I think I’m narrowing in on a root cause but there might be multiple. Do you have any resolution-mode import assertions/attributes in the codebases where you experience this crash? E.g.

import type pkg from "pkg" with { "resolution-mode": "import" }

@jerry2013
Copy link

@andrewbranch the JS project that I experience the tsserver crash problem has resolution-mode only in the dev dependencies prettier and webpack-dev-server

@andrewbranch
Copy link
Member

andrewbranch commented Jan 3, 2025

@jerry2013 what version of each?

Are you able to share the project you work on? If not, I may make a patch you can apply to make TS spit out an extra log to narrow down what’s going on. It sounds like you have a different root cause than I do.

@typescript-bot typescript-bot added the Fix Available A PR has been opened for this issue label Jan 3, 2025
@andrewbranch
Copy link
Member

Can folks try out the build at #60910 (comment)?

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
Projects
None yet
9 participants