Visual Studio Code “Failed to Connect to the remote Extension host server”

I have a Windows 11 PC and use Visual Studio Code connected to Windows Subsystem for Linux (WSL). Occasionally, I wake up my PC from sleep mode. I then try to reconnect to WSL from VS Code. And I would get the following error.

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

Resolution:

In the windows command prompt, run

wsl -l --running
wsl --shutdown

Restart WSL

wsl

Go to Visual Studio Code.
Click bottom right corner to To Open A Remote Window.
Select Connect to WSL

Then upon opening folder of one of my repos located in WSL, I am able to load it.

Hope this helps you.

Leave a Reply