vscode icon indicating copy to clipboard operation
vscode copied to clipboard

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

Open AtlasAleks22 opened this issue 11 months ago • 3 comments

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

  • VS Code Version: 1.88.2
  • OS Version: Windows x64 10
  • WSL2 distro is Ubuntu Ubuntu 22.04.2 LTS

Steps to Reproduce: After clonsing the vs code instance & laptop and opened it the next day, suddenly i got
" Could not fetch remote environment & Failed to connect to the remote extension host server (Error: WebSocket close with status code 1006)" error while tryin to connect to WSL instance. It is not the first time I've encountered this issue. I can't take things from scratch every time i get this error. I tried to reboot windows, NO change. I tried to reboot WSL from CMD with " wsl --distribution Ubuntu" and it worked. VS Code doesn't want to conect to it.

AtlasAleks22 avatar Jul 08 '23 14:07 AtlasAleks22

Thanks for creating this issue! It looks like you may be using an old version of VS Code, the latest stable release is 1.80.0. Please try upgrading to the latest version and checking whether this issue remains.

Happy Coding!

VSCodeTriageBot avatar Jul 08 '23 14:07 VSCodeTriageBot

I have reinstalled Vs Code and I got the same issue.... same erros. Here are the details of the verisons: Version: 1.80.0 Date: 2023-07-04T15:06:02.407Z Electron: 22.3.14 ElectronBuildId: 21893604 Chromium: 108.0.5359.215 Node.js: 16.17.1 V8: 10.8.168.25-electron.0 OS: Windows_NT x64 10.0.19045

AtlasAleks22 avatar Jul 08 '23 14:07 AtlasAleks22

I was able to solve this issue by completing these steps found in here

  1. Start WSL2 with > wsl.exe from the windows terminal, or with windows application icon (such as Ubuntu).
  2. Change directory to home directory.
  3. Remove .vscode-server, such as $ rm -rf .vscode-server.
  4. Finally, start VSCode and Remote-WSL: New Window. (VSCode makes new .vscode-server.)

Will have to check if the issue keeps appearing after rebooting computer

AtlasAleks22 avatar Jul 09 '23 09:07 AtlasAleks22

Thanks for reporting. These issues are difficult to investigate. I'll close the issue for now. If you see it again and have more information, please let us know.

aeschli avatar Aug 18 '23 10:08 aeschli

I was able to solve this issue by completing these steps found in here

  1. Start WSL2 with > wsl.exe from the windows terminal, or with windows application icon (such as Ubuntu).
  2. Change directory to home directory.
  3. Remove .vscode-server, such as $ rm -rf .vscode-server.
  4. Finally, start VSCode and Remote-WSL: New Window. (VSCode makes new .vscode-server.)

Will have to check if the issue keeps appearing after rebooting computer

I ran into the same issue just now,

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

and the fix you commented helped me out. Thanks for posting it.

hamirmahal avatar Sep 17 '23 19:09 hamirmahal

Just to simplify the instructions, running this command from your WSL2 terminal should fix the issue.

  1. Exit out of VSCode entirely.
  2. Run rm -rf ~/.vscode-server/ from your WSL2 terminal.
  3. Open VSCode again.

Open an issue at https://github.com/microsoft/vscode/issues/ if the issue still persists.

hamirmahal avatar Sep 17 '23 19:09 hamirmahal