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

code --install-extension path/to/file.vsix fails with unclear error when dependency extension is not installed #233375

Open
jvilk-stripe opened this issue Nov 8, 2024 · 2 comments
Assignees

Comments

@jvilk-stripe
Copy link

jvilk-stripe commented Nov 8, 2024

Does this issue occur when all extensions are disabled?: N/A

  • VS Code Version: 1.94.2
  • OS Version: Mac OS 1.5.0.1

Steps to Reproduce:

  1. Attempt to install an extension $some_extension from VSIX that depends on another extension $dependency that is not installed via code --install-extension.
  2. Witness the following very unhelpful error message:
Error: Unable to resolve nonexistent file '/Users/jvilk/.vscode/extensions/$dependency'
    at Ta.resolve (file:///Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/code/node/cliProcessMain.js:52:84339)
    at async Ca.H (file:///Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/code/node/cliProcessMain.js:52:74456)
    at async Promise.all (index 21)
    at async Ca.scanAllUserExtensions (file:///Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/code/node/cliProcessMain.js:52:69779)
    at async ja.w (file:///Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/code/node/cliProcessMain.js:52:79734)
    at async ja.h (file:///Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/code/node/cliProcessMain.js:52:77963) {
  code: 'Scanning',
  name: 'Scanning'
}

A reader might think that this error message is sufficiently clear; if you are installing $some_extension and get this error about $dependency, maybe you need $dependency. Unfortunately, you also get this error if you are installing both $dependency and $some_extension in the wrong order in one CLI invocation. In this context, this error message is very confusing:

code --install-extension $some_extension.vsix --install-extension $dependency.vsix

I was able to solve this confusing mystery with debug output, which revealed that the error about $dependency occurred while installing $some_extension:

  ERR Error while installing the extension $some_extension Unable to resolve nonexistent file '/Users/jvilk/.vscode/extensions/$dependency'

Some possible ways to fix:

  • Adjust the error message to indicate that the dependency must be installed first.
  • (Harder) When provided a list of extensions to install, order them to install dependencies first.

This issue came up while working on the system Stripe uses to manage/install custom extensions that are not present in the Marketplace. We have some that depend on one-another now, causing this new wrinkle. Our workaround is to retry n times until success, so long as we have forward progress.

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.95.2. Please try upgrading to the latest version and checking whether this issue remains.

Happy Coding!

@jvilk-stripe jvilk-stripe changed the title code --install-extension path/to/file.vsix fails with unclear error when dependent extension is not installed code --install-extension path/to/file.vsix fails with unclear error when dependency extension is not installed Nov 8, 2024
@jvilk-stripe
Copy link
Author

I've hit another bug with this in remote development as opposed to the native VS Code; doing code-server --install-extension $some_extension.vsix --install-extension $dependency.vsix can cause $some_extension to be extracted into ~/.code-server/extensions/$some_extension-version but not installed, which causes all subsequent installs of $some_extension to fail until I manually remove that folder. If I have time, I'll see if I can repro that other, somewhat related bug with some OSS extensions.

There's a third bug where code --uninstall-extension $dependency --uninstall-extension $some_extension fails because it uninstalls extensions in order, and fails uninstalling $dependency because $some_extension is installed. We work around that by retrying with the first extension in the list pushed to the back until all requested extensions are uninstalled.

I can file these separately if there is interest in fixing, otherwise I'll save my time -- I know the VSIX path isn't the 'golden path' for VS Code. :)

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

No branches or pull requests

2 participants