vscode: Unable to run sandboxed process when run as elevated under applocker
- VS Code Version: 1.56.0-insider (user setup)
- OS Version: Windows_NT x64 10.0.19042
- Electron: 12.0.4
- Chrome: 89.0.4389.114
- Node.js: 14.16.0
- V8: 8.9.255.24-electron.0
Steps to Reproduce:
- Open a markdown file, and click the “Open preview to the side” button
- The preview window is blank, and an error notification pops up in the bottom right:
Error loading webview: Error: Could not register service workers: TypeError: Failed to register a ServiceWorker for scope (‘vscode-webview://36f8a74c-37c6-4d60-9d4c-87414f69ebcc/’) with script (‘vscode-webview://36f8a74c-37c6-4d60-9d4c-87414f69ebcc/service-worker.js?platform=electron&id=36f8a74c-37c6-4d60-9d4c-87414f69ebcc&vscode-resource-origin=https%3A%2F%2F36f8a74c-37c6-4d60-9d4c-87414f69ebcc.vscode-webview-test.com’): ServiceWorker cannot be started.
The same thing happens for other WebViews, like opening an extension from the Extensions sidebar, or using the “Issue Reporter”.
Does this issue occur when all extensions are disabled?: Yes
About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 92
- Comments: 121 (31 by maintainers)
I killed existing related processes, this works again for me.
@eduncan911 and others who are facing the issue on linux, please open a separate issue as the root cause is unrelated. This issue only tracks the problem on windows due to chromium sandbox disallowing to start the service worker process when run as elevated.
I encountered this problem after upgrading vscode server and solved it by killing all existing vscode-server processes and restarting vscode all over.
In my case, this seems to be related to some conflicts between the upgrade operation and the previous processes.
I know this is probably expected but just wanted to add that this is still broken in 1.57.0
Since 1.66 as non-admin nothing works anymore. “no-sandbox” param works as a workaround, but sounds not like the right way doing it. Can you fix this serious bug, please?
Actually, 1.59 on windows, still can’t open the any web view extension, even no error popup, any solutions or fix plan?
Don’t know if it is the same issue, no WebView opens in either of my windows, local/remote
Just had this issue. I closed two code windows, then quickly opened up another one that had a markdown preview already open and was unable to load the preview exactly like issue 128649. I closed the preview, opened a new one, same issue. Restarted code a few times, same error.
Finally I closed Code, ran
ps -ef | grep -i codedid not return any running instances. I let it sit for about 20 seconds, launched Code again, and was able to load the preview.I’m on Ubuntu 22.04, installing from the
aptrepo, not using a Snap. Non-insiders.The --no-sandbox parameter fixed it for me (running as admin).
I had similar issue on Ubuntu, For me upgrading VScode to 1.59 and google chrome to 92 fixed the issue.
@deepak1556 all other Linux issues related to this were closed as Duplicates, and pointed to this long thread. That means people need to retrospectively find and re-open those other issues.
Also, doesn’t this ticket have the Linux label ?
¯\_(ツ)_/¯Hello All, I’m in the Azure Edge Robotics team, maintaining the VSCode extension for ROS. We are hitting this issue as well for our Robot Visualizer. It seems to be related to a move from vscode-resource to https?
For example, we have a workspace rooted at c:\ws\tb, which has sources including stl files. We convert this to a file URI, then to a webview URI. Before the update, it would look something like:
vscode-resource://c%3A/ws/tb/src/turtlebot3/turtlebot3_description/meshes/wheels/right_tire.stlbut now looks like this:
The
file///does not look right to me.For me using
code --no-sandboxsolved the problem and I can see the Markdown Preview on one of my machines (running on VM). On other machines - it doesn’t help at all.I have noticed this issue on the stable build of 1.56.0 that was just released. I have found it only happens if I run vscode as administrator. I noticed because I couldn’t read the release notes 😂
Error loading webview: Error: Could not register service workers: TypeError: Failed to register a ServiceWorker for scope (‘vscode-webview://vs_code_release_notes/’) with script (‘vscode-webview://vs_code_release_notes/service-worker.js?platform=electron&id=vs_code_release_notes&vscode-resource-origin=https%3A%2F%2Fvs_code_release_notes.vscode-webview-test.com’): ServiceWorker cannot be started.
On Windows 11 (v1.82.2) with standard install, there is a workaround:
@deepak1556 could you provide a link to the Linux issue you reportedly re-opened?
Like many others, I searched through 10s of auto-closed issues and chains of auto-generated “look at this issue” before coming across this issue. While I acknowledge that probably saves you a lot of time, it is an objectively horrible experience for users faced with genuine bugs.
Thanks!
Any updates on issue solution? running VSCode as admin and unable to view extension webview in app. --no-sandbox workaround does not really help
I get this issue when trying to open Git History (https://marketplace.visualstudio.com/items?itemName=donjayamanne.githistory). This used to work a few days ago, but now the window is blank with the error message:
Full Error Message: Error loading webview: Error: Could not register service workers: InvalidStateError: Failed to register a ServiceWorker: The document is in an invalid state…
Just a note to say --no-sandbox is no longer available in the newest version and this webview error still persists (particularly in Latex-workshop
I am having the same issue as described in #128649 on OS-X in Version 1.82.2
@elvinagam - did you try closing all vscode instances as noted here? For me,
killall code- restart, and it started working again.I use vscode to develop and debug PowerShell scripts. And because of AppLocker, PowerShell is run in Constrained Language Mode, disabling a lot of needed features. https://devblogs.microsoft.com/powershell/powershell-constrained-language-mode/
Also still seeing this in
1.67.1while not running as Administrator. As people have mentioned, closing all instances of VSCode and restarting generally fixes the issue.Can we make a
--no-sandboxa config setting?Still getting a blank screen with any preview or report issue. No longer getting a webview error.
Version: 1.63.2 (system setup) Commit: 899d46d82c4c95423fb7e10e68eba52050e30ba3 Date: 2021-12-15T09:40:02.816Z Electron: 13.5.2 Chromium: 91.0.4472.164 Node.js: 14.16.0 V8: 9.1.269.39-electron.0 OS: Windows_NT x64 10.0.19042
@joshxyzhimself restarting VSCode is not always the same as restarting all of its background processes. Please check my Aug 29 comment or restart your system to be sure.
Fixed with restart of Ubuntu at
v1.61.2I think the Linux issue is https://github.com/microsoft/vscode/issues/125993
I noticed a left out process tree after closing my VSCode and search for “code” on my system monitor. When I terminated it and reopen VSCode, the problem was resolved.
OS: “Ubuntu 20.04.3 LTS (Focal Fossa)” VSCode version: 1.59.1 Commit: 3866c3553be8b268c8a7f8c0482c0c0177aa8bfa Date: 2021-08-19T11:54:37.513Z Electron: 13.1.7 Chrome: 91.0.4472.124 Node.js: 14.16.0 V8: 9.1.269.36-electron.0 OS: Linux x64 5.11.0-27-generic snap
it is helpful for me! https://stackoverflow.com/questions/67698176/error-loading-webview-error-could-not-register-service-workers-typeerror-fai
Happy to report symptoms have disappeared on Linux-based platforms on upgrade to VS Code 1.57.0, but still present on Windows 10.
The webview problem was manifesting for me with:
Here are the application stacks for my installations:
Ubuntu 20.04.2 LTS (Focal Fossa) working
Chrome OS 91.0.4472.81 (Official Build) (64-bit) working
Windows 10 Professional broken
Also seems to be happening to a few Linux users, see #125993
@StanKirilov Can you run with
code --no-sandbox --user-data-dir <specify-some-absolute-directory-path-here>@haugerbr can you launch with
code.cmd --no-sandboxand check if it helps. If not, can you attach the output ofcode.cmd --verbose