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

Error: "Debug Failure. File ... has unknown extension" #1187

Open
arggh opened this issue Sep 29, 2021 · 4 comments
Open

Error: "Debug Failure. File ... has unknown extension" #1187

arggh opened this issue Sep 29, 2021 · 4 comments
Labels
bug Something isn't working upstream

Comments

@arggh
Copy link

arggh commented Sep 29, 2021

Describe the bug

Suddenly, after working for a while, Svelte for VS Code stops working. It will still give me options for auto-importing files, but there is no path included in the options and selecting an option doesn't add any imports to the file being edited.

The error shown in the output tab says:

Error: Debug Failure. File ../components/LanguageSelectButton.svelte has unknown extension.

Not sure what the error actually means, but pretty sure the file has a known extension, .svelte.

The output tab content for Svelte

Using Svelte v3.43.0 from /Users/arggh/Develop/example/example-foo/node_modules/svelte/compiler
Error: Debug Failure. File ../../../../../packages/example-ui/src/LanguageSelect/LanguageSelect.svelte has unknown extension.
at Object.extensionFromPath (/Users/arggh/.vscode-insiders/extensions/svelte.svelte-vscode-105.4.0/node_modules/typescript/lib/typescript.js:20405:51)
at getJSExtensionForFile (/Users/arggh/.vscode-insiders/extensions/svelte.svelte-vscode-105.4.0/node_modules/typescript/lib/typescript.js:117454:136)
at removeExtensionAndIndexPostFix (/Users/arggh/.vscode-insiders/extensions/svelte.svelte-vscode-105.4.0/node_modules/typescript/lib/typescript.js:117447:42)
at getLocalModuleSpecifier (/Users/arggh/.vscode-insiders/extensions/svelte.svelte-vscode-105.4.0/node_modules/typescript/lib/typescript.js:117000:17)
at computeModuleSpecifiers (/Users/arggh/.vscode-insiders/extensions/svelte.svelte-vscode-105.4.0/node_modules/typescript/lib/typescript.js:116967:33)
at Object.getModuleSpecifiersWithCacheInfo (/Users/arggh/.vscode-insiders/extensions/svelte.svelte-vscode-105.4.0/node_modules/typescript/lib/typescript.js:116927:26)
at getModuleSpecifiers (/Users/arggh/.vscode-insiders/extensions/svelte.svelte-vscode-105.4.0/node_modules/typescript/lib/typescript.js:146057:72)
at /Users/arggh/.vscode-insiders/extensions/svelte.svelte-vscode-105.4.0/node_modules/typescript/lib/typescript.js:146060:26
at Object.flatMap (/Users/arggh/.vscode-insiders/extensions/svelte.svelte-vscode-105.4.0/node_modules/typescript/lib/typescript.js:713:25)
at getNewImportFixes (/Users/arggh/.vscode-insiders/extensions/svelte.svelte-vscode-105.4.0/node_modules/typescript/lib/typescript.js:146059:28)
Using Svelte v3.43.0 from /Users/arggh/Develop/example/node_modules/svelte/compiler
SnapshotManager File Statistics:
Project files: 0
Svelte files: 204
From node_modules: 309
Total: 729
Using Svelte v3.43.0 from /Users/arggh/Develop/example/node_modules/svelte/compiler

Screenshots

Screenshot 2021-09-29 at 16 12 11

System (please complete the following information):

  • OS: Mac OS 11.6 M1
  • IDE: VSCode
  • Plugin/Package: Svelte for VSCode
@arggh arggh added the bug Something isn't working label Sep 29, 2021
@jasonlyu123
Copy link
Member

We might need a reproducible for this one. The error is thrown by typescript as shown in the error stack. Typescript's codebase is very complex. Without a reproducible, it's really hard to track down the problem.

@jasonlyu123
Copy link
Member

I guess I have found a reproducible. Can you check if you have the "typescript.preferences.importModuleSpecifierEnding": "js", or "javacript.preferences.importModuleSpecifierEnding": "js", config?

@jasonlyu123
Copy link
Member

It's also possible that the "typescript.preferences.importModuleSpecifierEnding" config is set to auto but there's an existing import in the file that imported with a js file extension like import {} from 'path/to/module.js'. It is quite tricky to fix on our side. I can't find a workaround for all cases.

Guess it would be better we file an issue on the typescript repo to ask if they can remove this debug assertion or not. This might also happen in a lot of tooling for component frameworks with a custom file extension. I tried and it also appears in vetur (for vue). So it might be more beneficial to "fix" on the typescript side.

@dummdidumm
Copy link
Member

If the module specified ending is the problem - this might get much more pressing soon, when TS 4.5 is released which brings a ESM mode where module specifier endings are mandatory.

dummdidumm pushed a commit that referenced this issue Nov 16, 2021
…1242)

Related to #1187
TypeScript throws a debug assertion error if the importModuleSpecifierEnding config is 'js' and there's an unknown file extension (like '.svelte').

Although it's probably better to fix this on the TypeScript side, that it would probably take a while. So this is a workaround for now. Not all cases are fixed, but at least it's less likely to happen.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working upstream
Projects
None yet
Development

No branches or pull requests

3 participants