vscode: Failed to connect to the remote extension host server (Error: WebSocket close with status code 1006)

  • VSCode Version: 1.53.0 (user setup)
  • OS Version: Windows_NT x64 10.0.19042 64bit

Steps to Reproduce:

  1. Enter code . command on a folder on WSL2
  2. The error is thrown
Could not fetch remote environment
Failed to connect to the remote extension host server (Error: WebSocket close with status code 1006)

VSCode version 1.52.1 does not have this issue.

Does this issue occur when all extensions are disabled?: Yes

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 62
  • Comments: 69 (12 by maintainers)

Most upvoted comments

This did the job for me: I closed both Linux WSL tab and VsCode, them I opened a command prompt (with admin priviligies) and used this: wsl --shutdown After that I opened my linux tab again, type “code .” and… after a minute it worked for me. I hope this help you out.

Remote-WSL extension (0.53.3) solved the issue. I have to install it in WSL using command code --install-extension ms-vscode-remote.remote-wsl then close the wsl using wsl --shutdown

to make it work again

I pushed a new version of the Remote-WSL extension (0.53.3) that hopefully solves the issue.

The extension now first tests if the WSL2 VM can be accessed by it’s IP. If not we accessed it through localhost (::1). There’s now also a setting "remote.WSL.server.connectThroughLocalhost": true to enforce that mode.

Please let me know if that solves the problem

Disbale the http proxy and it works image

(Experimental duplicate detection) Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:

I have the same issue. Downgrading to 1.52.1 solved the problem.

Maybe is related with this issue https://github.com/microsoft/vscode/issues/105536

OS: Windows_NT x64 10.0.18362

This did the job for me: I closed both Linux WSL tab and VsCode, them I opened a command prompt (with admin priviligies) and used this: wsl --shutdown After that I opened my linux tab again, type “code .” and… after a minute it worked for me. I hope this help you out.

Thanks, this worked for me !

@trallnag ok, I will reopen this issue.

In my computer, the loading speed is very slow.

This did the job for me: I closed both Linux WSL tab and VsCode, them I opened a command prompt (with admin privileges) and used this: wsl --shutdown After that I opened my linux tab again, type “code .” and… after a minute it worked for me. I hope this help you out.

Thanks a lot for your response, and it would fix the issue temporarily, and after one or 2 restarts of my containers the communication would break again, also debug will work fine, then go totally crazy, I created a separate ticket for this particular issue

Hi, after updating to the Remote-WSL extension 0.53.4 and adding the parameters the base environment seems to be working again, but the debugging is totally broken, by default the container cannot longer see the WSL host, so xDebug can’t connect, and when the IP actually resolves and the container gets to connect to VsCode, the debug won’t work as expected, just some breakpoints work, and full of “error evaluating code”

Also would like to add that after the update my settings.json is clean, what contents should it have?

Remote-WSL extension (0.53.3) fixed it for me too, don’t forget to restart WSL or it won’t work. edit: I restarted it using windows services LxssManager win + r services.msc right click on LxssManager restart

Invoking code using code --proxy-server= ... --proxy-bypass-list=... . doesnt change the result for me. Still the same error.

I’ll be wating for the patch. In the meantime I’m reverting to the previous version.

@pppetrov Thanks, disable proxy settings in vscode settings fixed issue. Since WSL remote not working. I have to manually remove it in ~/.vscode-server/data/Machine/settings.json

I have the same issue. Downgrading to 1.52.1 solved the problem. Maybe is related with this issue #105536 OS: Windows_NT x64 10.0.18362

How to downgrade? Where I can download 1.52.1 version? Thanks

@NormandoHall You can get the old version here. (tip make sure you disable automatic updates if you have them on)

i’m facing the same issue.

vscode 1.55.1 remote-containers v0.166.1

tried many of the steps suggested before… but nothing is working

0.65.1 : FAIL 0.51.0 : SUCCESS (after rm -rf .vscode-server from remote server)

Convert WSL2 Distoribution to WSL one solved this problem.

Hi, I’m having the same issue with Linux as well

Remote-WSL extension (0.53.3) solved it for me.

Starting with code --proxy-server=<proxy> --proxy-bypasslist=<wsl ip-address> should make it work. The IP-address can be found with ip addr inside the WSL distro.

@pppetrov That’s the log when a windows connects to a remote server that is already running (started be another window). Can you close all windows, wait 10 seconds, reopen the windows and capture the WSL log?