Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio Code 1.79.1 launch in admin mode fails with code 18

After upgrading my VS Code to version 1.79.1 it is throwing error when I am trying to launch in admin mode. Without admin mode launch is working. Adding the screenshot of the error and the version details below. enter image description here

The window terminated unexpectedly (reason:'launch-failed',code:'18')

enter image description here

like image 995
soumyadeb ghoshal Avatar asked Dec 16 '25 13:12

soumyadeb ghoshal


2 Answers

Googling "github vscode issues windows administrator code 18", I found this issue ticket: Can't run as Administrator - launch-failed code 18 #185057, where a maintainer said:

Please refer to https://code.visualstudio.com/docs/setup/windows#_unable-to-run-as-admin-when-applocker-is-enabled for launching as administrator.

Currently --no-sandbox does not work as expected which is being resolved in #184687 and fix will be available in 1.79.2.

From the linked user documentation:

With the introduction of process sandboxing (discussed in this blog post) running as administrator is currently unsupported when AppLocker is configured due to a limitation of the runtime sandbox. If your work requires that you run VS Code from an elevated terminal, you can launch code with --no-sandbox --disable-gpu-sandbox as a workaround.

Subscribe to issue #122951 to receive updates.

Until VS Code 1.79.2 is released, you can try using VS Code Insiders with --no-sandbox --disable-gpu-sandbox.

Apparently updating to 1.79.2 has not fixed this issue for several users. I am still watching the issue ticket and will update this answer as the situation evolves.

Note that in VS Code 1.80, there is a new flag, --disable-chromium-sandbox, that can be used in the place of --no-sandbox --disable-gpu-sandbox, and some other related features that you might be interested in. It can also be placed in argv.json (run Preferences: Configure Runtime Arguments in the command palette to open argv.json).

like image 55
starball Avatar answered Dec 19 '25 05:12

starball


The workaround I found on version 1.81.1 with a system-wide install is the following.

  1. Open an instance of visual studio code running as a normal user.
  2. Launch a second instance with code --no-sandbox --disable-gpu-sandbox
like image 20
gio13 Avatar answered Dec 19 '25 06:12

gio13



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!