DanielBell99
DanielBell99

Reputation: 1927

VSCode says "The editor cannot be opened due to an unexpected error: No file system provider found for resource 'vscode-remote://wsl%2Bubuntu/...' "

Goal: Get regular Bash and Git in Terminal working for Python projects in Visual Studio Code.

Anytime I launch, I see this error. I cannot open code or use Terminal.

Visual Studio Code screen

Error Message:

The editor cannot be opened due to an unexpected error: No file system provider found for resource 'vscode-remote://wsl%2Bubuntu/...'

Update: Uninstalled WSL. I no longer have the below old Terminal output.

Terminal:

[2022-06-13 15:53:18.277] Resolving wsl+ubuntu, resolveAttempt: 1
[2022-06-13 15:53:18.361] Starting VS Code Server inside WSL (wsl1)
[2022-06-13 15:53:18.361] Extension version: 0.66.3
[2022-06-13 15:53:18.361] Windows build: 19044. Multi distro support: available. WSL path support: enabled
[2022-06-13 15:53:18.361] No shell environment set or found for current distro.
[2022-06-13 15:53:18.546] WSL daemon log file: 
[2022-06-13 15:53:18.548] Probing if server is already installed: C:\WINDOWS\System32\wsl.exe -d Ubuntu -e sh -c "[ -d ~/.vscode-server/bin/c3511e6c69bb39013c4a4b7b9566ec1ca73fc4d5 ] && printf found || ([ -f /etc/alpine-release ] && printf alpine-; uname -m)"
[2022-06-13 15:53:19.023] Probing result: x86_64
[2022-06-13 15:53:19.024] No server install found in WSL, needs linux-x64
[2022-06-13 15:53:19.024] Downloading server on client side to C:\Users\dabell\AppData\Local\Temp\vscode-remote-wsl\c3511e6c69bb39013c4a4b7b9566ec1ca73fc4d5\vscode-server-stable-linux-x64.tar.gz.
[2022-06-13 15:53:19.024] https://update.code.visualstudio.com/commit:c3511e6c69bb39013c4a4b7b9566ec1ca73fc4d5/server-linux-x64/stable
[2022-06-13 15:53:26.719] Unable to download server on client side: Error: Request downloadRequest failed with message: getaddrinfo ENOTFOUND update.code.visualstudio.com. Will try to download on WSL side.
[2022-06-13 15:53:26.721] Launching C:\WINDOWS\System32\wsl.exe -d Ubuntu sh -c '"$VSCODE_WSL_EXT_LOCATION/scripts/wslServer.sh" c3511e6c69bb39013c4a4b7b9566ec1ca73fc4d5 stable code-server .vscode-server --host=127.0.0.1 --port=0 --connection-token=1433349295-3472956524-2784734323-674824766 --use-host-proxy --without-browser-env-var --disable-websocket-compression --accept-server-license-terms --telemetry-level=all'
[2022-06-13 15:53:27.103] Setting up server environment: Looking for /home/danielbellhv/.vscode-server/server-env-setup. Not found.
[2022-06-13 15:53:27.104] WSL version: 4.4.0-19041-Microsoft Ubuntu
[2022-06-13 15:53:27.104] Updating VS Code Server to version c3511e6c69bb39013c4a4b7b9566ec1ca73fc4d5
[2022-06-13 15:53:27.104] Removing previous installation...
[2022-06-13 15:53:27.104] Installing VS Code Server for x64 (c3511e6c69bb39013c4a4b7b9566ec1ca73fc4d5)
[2022-06-13 15:53:27.104] Downloading:     
[2022-06-13 15:53:37.329] 100%
[2022-06-13 15:53:37.329] Failed
[2022-06-13 15:53:37.331] --2022-06-13 16:53:37--  https://update.code.visualstudio.com/commit:c3511e6c69bb39013c4a4b7b9566ec1ca73fc4d5/server-linux-x64/stable
[2022-06-13 15:53:37.331] Resolving update.code.visualstudio.com (update.code.visualstudio.com)... 
[2022-06-13 15:53:47.093] failed: Temporary failure in name resolution.
[2022-06-13 15:53:47.093] wget: unable to resolve host address ‘update.code.visualstudio.com’
[2022-06-13 15:53:47.093] ERROR: Failed to download https://update.code.visualstudio.com/commit:c3511e6c69bb39013c4a4b7b9566ec1ca73fc4d5/server-linux-x64/stable to /home/danielbellhv/.vscode-server/bin/c3511e6c69bb39013c4a4b7b9566ec1ca73fc4d5-1655135606.tar.gz
[2022-06-13 15:53:47.094] VS Code Server for WSL closed unexpectedly.
[2022-06-13 15:53:47.094] For help with startup problems, go to https://code.visualstudio.com/docs/remote/troubleshooting#_wsl-tips
[2022-06-13 15:53:47.116] WSL Daemon exited with code 0

Upvotes: 24

Views: 66943

Answers (16)

MazBeye
MazBeye

Reputation: 912

running wsl --shutdown from windows command line and relaunch the vscode solved my issue.

edited: The command basically shuts down the WSL without restarting the host (Windows).

However, just as @ps2goat mentioned, any VSCode instances connected remotely to WSL will need to be relaunched. As they would've effectively lost the remote connection to the WSL.

The first relaunched VSCode session will kickstart the WSL, and we're back in business.

Upvotes: 22

tomups
tomups

Reputation: 6175

In my case I had to uninstall the WSL extension, remote development, tunnels... I basically uninstalled all extensions that could have to do with connecting to WSL.

Closed VSCode, opened it again, tried to connect to WSL which auto-installed the needed extensions, and it worked again.

Upvotes: 0

SimoneB
SimoneB

Reputation: 627

Deleting .vscode-server and .vscode-remote-containers folders sovled the issue for me

Upvotes: 2

Hadr Barshli
Hadr Barshli

Reputation: 1

The VS Code Welcome page has a "Start" section, and under it there's a few options, one of which is the "Connect to...". I clicked that and then some options popped up, one of them had something to do with remote WSL. I changed it and that solved the problem, though I'm still not able to understand.

Upvotes: 0

Alex
Alex

Reputation: 54

I encountered this error using VSCODE remote desktop to a Linux box. To fix the problem I simply had to kill all processes running on the server and restart VSCODE locally.

Upvotes: 0

Mihai Gheoace
Mihai Gheoace

Reputation: 11

It happened to me in 2024 due to an vscode update not installed in the vscode wsl server. Close the opened vscode windows and restart them manually. It will reconnect(while notifying of an update in the down right corner), if the update is the issue.

Upvotes: 0

chiashurb
chiashurb

Reputation: 71

I came across this issue today running VS Code on Linux (bare metal, not WSL). I am using docker-desktop for container services and the problem was that docker-desktop's VM had run out of disk space (the physical disk had plenty of space, but the VHD allocated to docker was full).

Upvotes: 0

Travis
Travis

Reputation: 271

Disclaimer: This answer has nothing to do with WSL... but I had a very similar problem and wasn't able to find an answer anywhere. Adding my solution here because this question was a top search result for me.

My problem (in VS Code for Web) was due to some built-in extensions having been disabled. Specifically Remote Repositories, GitHub Repositories, and Azure Repos. The issue was immediately resolved after enabling all disabled built-in extensions.

enter image description here

P.S. When I looked at the output for Extension Host (Worker) I saw the same (or similar) error message as is seen in the image presented by the OP. This led me down the path of checking extensions (and eventually the built-in ones).

Upvotes: 0

Pierre
Pierre

Reputation: 49

Remove folder .vscode-server and restart VSCode

Upvotes: 4

Afeef Razick
Afeef Razick

Reputation: 51

Tried shutting down WSL using wsl --shutdown and restarting vs code, but it still didn't work.

What i had to do was also close other vs code instances and ensure VS code was not running in the background. It works now.

Upvotes: 4

DanielBell99
DanielBell99

Reputation: 1927

I simply uninstalled and reinstalled WSL 2, from Windows Store.

You can via command line, but I found using Windows Store to be more accessible / user friendly.

Upvotes: -2

Starnuto di topo
Starnuto di topo

Reputation: 3569

I had the same issue, caused by a broken installation of Ubuntu; basically, the Ubuntu installation was forcibly aborted, but some configuration still remained and I could see the distro listed by the wsl --list command.

I manually unregistered the distro, issuing the following command in Powershell:

wsl --unregister Ubuntu

Afterwards, I also checked wsl --list to be sure that:

  1. the offending distro was not present any more and

  2. that the default distro was correct)

Then everything started to work properly again.

Upvotes: 0

Cthuflu
Cthuflu

Reputation: 131

This can be solved temporarily by restarting the WSL container's network.

Open Powershell as administrator and run the following command:

Restart-Service LxssManager

I would advise saving it to a script such as restart-WSL-network.ps1 and setting up a shortcut to run this when it happens again.

Upvotes: 12

Tashi
Tashi

Reputation: 673

Something was hung for me. Couldn't restart wsl, so restarted the PC, made sure wsl is running, then docker if you are using docker and vscode opens fine.

Upvotes: 1

Yahatix
Yahatix

Reputation: 291

Deleting the .vscode* folders in the home directory (in wsl) fixed the issue

Upvotes: 18

Đumić Branislav
Đumić Branislav

Reputation: 387

I'm kind of late to the party, but I've just had this issue today. I only restarted Windows, and now it works fine!

Upvotes: 7

Related Questions