You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Open any webcomponent file like libs/core/src/new-session/new-session.element.ts
Change first import to a type import (add type keyword after the import)
As soon as that is done - typescript server will crash and become unusable until restarted
Observe the errors in logs: Error: Debug Failure. should never ask for module name at index higher than possible module name
You can find the errors logged in "Remote Extension Host" tab:
2023-02-05 02:48:20.909 [error] [vscode.typescript-language-features] provider FAILED
2023-02-05 02:48:20.909 [error] Error: <semantic> TypeScript Server Error (4.9.5)
Debug Failure. should never ask for module name at index higher than possible module name
Error: Debug Failure. should never ask for module name at index higher than possible module name
at getModuleNameStringLiteralAt (/home/dev/proj/game-companion/node_modules/typescript/lib/tsserver.js:122282:18)
at getModeForResolutionAtIndex (/home/dev/proj/game-companion/node_modules/typescript/lib/tsserver.js:118912:46)
at moduleNameResolvesToAmbientModuleInNonModifiedFile (/home/dev/proj/game-companion/node_modules/typescript/lib/tsserver.js:119884:105)
at resolveModuleNamesReusingOldState (/home/dev/proj/game-companion/node_modules/typescript/lib/tsserver.js:119844:64)
at processImportedModules (/home/dev/proj/game-companion/node_modules/typescript/lib/tsserver.js:121306:35)
at findSourceFileWorker (/home/dev/proj/game-companion/node_modules/typescript/lib/tsserver.js:121086:17)
at findSourceFile (/home/dev/proj/game-companion/node_modules/typescript/lib/tsserver.js:120932:26)
at processImportedModules (/home/dev/proj/game-companion/node_modules/typescript/lib/tsserver.js:121341:25)
at findSourceFileWorker (/home/dev/proj/game-companion/node_modules/typescript/lib/tsserver.js:121086:17)
at findSourceFile (/home/dev/proj/game-companion/node_modules/typescript/lib/tsserver.js:120932:26)
at processImportedModules (/home/dev/proj/game-companion/node_modules/typescript/lib/tsserver.js:121341:25)
at findSourceFileWorker (/home/dev/proj/game-companion/node_modules/typescript/lib/tsserver.js:121086:17)
at findSourceFile (/home/dev/proj/game-companion/node_modules/typescript/lib/tsserver.js:120932:26)
at processImportedModules (/home/dev/proj/game-companion/node_modules/typescript/lib/tsserver.js:121341:25)
at findSourceFileWorker (/home/dev/proj/game-companion/node_modules/typescript/lib/tsserver.js:121086:17)
at findSourceFile (/home/dev/proj/game-companion/node_modules/typescript/lib/tsserver.js:120932:26)
at processImportedModules (/home/dev/proj/game-companion/node_modules/typescript/lib/tsserver.js:121341:25)
at findSourceFileWorker (/home/dev/proj/game-companion/node_modules/typescript/lib/tsserver.js:121086:17)
at findSourceFile (/home/dev/proj/game-companion/node_modules/typescript/lib/tsserver.js:120932:26)
at processImportedModules (/home/dev/proj/game-companion/node_modules/typescript/lib/tsserver.js:121341:25)
at findSourceFileWorker (/home/dev/proj/game-companion/node_modules/typescript/lib/tsserver.js:121086:17)
at findSourceFile (/home/dev/proj/game-companion/node_modules/typescript/lib/tsserver.js:120932:26)
at processImportedModules (/home/dev/proj/game-companion/node_modules/typescript/lib/tsserver.js:121341:25)
at findSourceFileWorker (/home/dev/proj/game-companion/node_modules/typescript/lib/tsserver.js:121086:17)
at findSourceFile (/home/dev/proj/game-companion/node_modules/typescript/lib/tsserver.js:120932:26)
at processImportedModules (/home/dev/proj/game-companion/node_modules/typescript/lib/tsserver.js:121341:25)
at findSourceFileWorker (/home/dev/proj/game-companion/node_modules/typescript/lib/tsserver.js:121086:17)
at findSourceFile (/home/dev/proj/game-companion/node_modules/typescript/lib/tsserver.js:120932:26)
at /home/dev/proj/game-companion/node_modules/typescript/lib/tsserver.js:120881:85
at getSourceFileFromReferenceWorker (/home/dev/proj/game-companion/node_modules/typescript/lib/tsserver.js:120847:34)
at processSourceFile (/home/dev/proj/game-companion/node_modules/typescript/lib/tsserver.js:120881:13)
at processRootFile (/home/dev/proj/game-companion/node_modules/typescript/lib/tsserver.js:120682:13)
at /home/dev/proj/game-companion/node_modules/typescript/lib/tsserver.js:119483:67
at Object.forEach (/home/dev/proj/game-companion/node_modules/typescript/lib/tsserver.js:191:30)
at Object.createProgram (/home/dev/proj/game-companion/node_modules/typescript/lib/tsserver.js:119483:16)
at synchronizeHostData (/home/dev/proj/game-companion/node_modules/typescript/lib/tsserver.js:168926:26)
at Object.getProgram (/home/dev/proj/game-companion/node_modules/typescript/lib/tsserver.js:169040:13)
at ConfiguredProject.Project.updateGraphWorker (/home/dev/proj/game-companion/node_modules/typescript/lib/tsserver.js:174217:53)
at ConfiguredProject.Project.updateGraph (/home/dev/proj/game-companion/node_modules/typescript/lib/tsserver.js:174145:42)
at ConfiguredProject.updateGraph (/home/dev/proj/game-companion/node_modules/typescript/lib/tsserver.js:175311:63)
at Object.updateProjectIfDirty (/home/dev/proj/game-companion/node_modules/typescript/lib/tsserver.js:175802:45)
at ConfiguredProject.Project.getLanguageService (/home/dev/proj/game-companion/node_modules/typescript/lib/tsserver.js:173753:28)
at IpcIOSession.Session.getEncodedSemanticClassifications (/home/dev/proj/game-companion/node_modules/typescript/lib/tsserver.js:180546:32)
at Session.handlers.ts.Map.ts.getEntries._a.<computed> (/home/dev/proj/game-companion/node_modules/typescript/lib/tsserver.js:180006:61)
at /home/dev/proj/game-companion/node_modules/typescript/lib/tsserver.js:182034:96
at IpcIOSession.Session.executeWithRequestId (/home/dev/proj/game-companion/node_modules/typescript/lib/tsserver.js:182025:28)
at IpcIOSession.Session.executeCommand (/home/dev/proj/game-companion/node_modules/typescript/lib/tsserver.js:182034:41)
at IpcIOSession.Session.onMessage (/home/dev/proj/game-companion/node_modules/typescript/lib/tsserver.js:182062:35)
at process.<anonymous> (/home/dev/proj/game-companion/node_modules/typescript/lib/tsserver.js:186218:31)
at process.emit (node:events:526:28)
at emit (node:internal/child_process:938:14)
at processTicksAndRejections (node:internal/process/task_queues:84:21)
at Function.create (/home/dev/.vscode-server/bin/e2816fe719a4026ffa1ee0189dc89bdfdbafb164/extensions/typescript-language-features/dist/extension.js:2:1499361)
at h.w (/home/dev/.vscode-server/bin/e2816fe719a4026ffa1ee0189dc89bdfdbafb164/extensions/typescript-language-features/dist/extension.js:2:1494548)
at h.u (/home/dev/.vscode-server/bin/e2816fe719a4026ffa1ee0189dc89bdfdbafb164/extensions/typescript-language-features/dist/extension.js:2:1493613)
at ChildProcess.<anonymous> (/home/dev/.vscode-server/bin/e2816fe719a4026ffa1ee0189dc89bdfdbafb164/extensions/typescript-language-features/dist/extension.js:2:1493241)
at ChildProcess.emit (node:events:526:28)
at emit (node:internal/child_process:938:14)
at processTicksAndRejections (node:internal/process/task_queues:84:21)
Basically any time I add type imports it breaks TS server and I need to restart it manually.
I'm only getting this behavior in that specific repo which uses lit web components but maybe there is some bug with latest "NodeNext" module resolution as I'm using it only in that repo and nowhere else.
Please let me know if I can help in any way to debug this issue further.
UPDATE: I just tried to reproduce the issue with "moduleResolution": "node" and it's not happening anymore so it's basically a bug with "moduleResolution" set to node16 and nodenext.
UPDATE2: Also sometimes it crashes in the same way when I'm adding a completely new import to the file not a "type" but a normal one.
The text was updated successfully, but these errors were encountered:
andrewbranch
added
Bug
A bug in TypeScript
Crash
For flagging bugs which are compiler or service crashes or unclean exits, rather than bad output
labels
Feb 9, 2023
This should be fixed in 5.0, as #49738 did pretty significant refactoring around this code path in particular. Specifically, what happened was it was checking the counts of imports and augmentations to see if the new one was in range of the old ones, but failed to filter declare global blocks out of the augmentations when checking that index (so you added an import, and it'd think that new import's resolutions could be reused because of the declare global later in the file, even though it doesn't have resolutions). Now it doesn't use indices at all anymore, so it's much safer, and, side effect, no more crash bug. There may still be a usage or two of getModuleNameStringLiteralAt via getModeForResolutionAtIndex elsewhere in the compiler that don't properly account for declare global augmentation blocks not contributing to the index count, but if there are, I can't find them - this was probably the only one that tried to query old state with new data (in fact, it seems like they're only used by services endpoints now, and only for find all references work, and only on import statements directly, which should always have a trivially valid index into the import list).
Does this issue occur when all extensions are disabled?: Yes
Version: 1.75.0 (user setup)
Commit: e2816fe719a4026ffa1ee0189dc89bdfdbafb164
Date: 2023-02-01T15:23:45.584Z
Electron: 19.1.9
Chromium: 102.0.5005.194
Node.js: 16.14.2
V8: 10.2.154.23-electron.0
OS: Windows_NT x64 10.0.22621
Sandboxed: No
Running under WSL2 Ubuntu 22.04
Steps to Reproduce:
libs/core/src/new-session/new-session.element.ts
type
keyword after theimport
)Error: Debug Failure. should never ask for module name at index higher than possible module name
You can find the errors logged in "Remote Extension Host" tab:
Basically any time I add
type
imports it breaks TS server and I need to restart it manually.I'm only getting this behavior in that specific repo which uses lit web components but maybe there is some bug with latest "NodeNext" module resolution as I'm using it only in that repo and nowhere else.
Please let me know if I can help in any way to debug this issue further.
UPDATE: I just tried to reproduce the issue with
"moduleResolution": "node"
and it's not happening anymore so it's basically a bug with "moduleResolution" set tonode16
andnodenext
.UPDATE2: Also sometimes it crashes in the same way when I'm adding a completely new import to the file not a "type" but a normal one.
The text was updated successfully, but these errors were encountered: