'Failed to connect to the remote extension host server (Error: Handler already set!)

I went to open a repo using Vs Code on a remote ssh host. I can ssh in successfully but when I try to open a repo I get Failed to connect to the remote extension host server (Error: Handler already set!). I've tried un installing and re installing Vs Code. Does anyone have a fix other than switching ides.



Solution 1:[1]

avenmore comment helped me:

I started getting this message with v1.57.0 when trying to run a Vue project. Long story short: I usually have my DEBUG CONSOLE window docked inside to the right of my TERMINAL (powershell), and upon opening VSCode it wouldn't be visible and I'd get this message after building successfully and trying to launch. The work-around is to close VSCode, navigate to folder
USERPROFILE%\AppData\Roaming\Code\User\workspaceStorage and delete the contents (notably state.vscdb) and then restart VSCode. The DEBUG CONSOLE then shows itself again and all is fine unless I dock it again and close VSCode and there is a good chance of it happening again next time VSCode is opened. I have stopped docking the window inside the terminal and it hasn't happened since.

Solution 2:[2]

Try in settings.json add item "security.workspace.trust.enabled": false

Solution 3:[3]

For me what solved this was to go into the 'remote explorer' and clear out the SSH Targets that I already had in there before the upgrade, and then just paste them in again. Now I can connect. For example, a re-pasted SSH command looked like:

 ssh -i "/Users/myuseraccount/abc.pem" [email protected]

A few days later this stopped working again. I think maybe because my SSH targets config saved what I pasted in as my SSH connection command. It appears "sometimes" if there are any entries in the SSH target config file, that this error occurs.

I find to ensure this error never occurs do

  rm ~/.ssh/config

every time before you open Vs Code. Assuming ~/.ssh/config is where your Vs Code is reading its SSH entries from. There is one other place possible under /etc/$somewhere (I dont know where).

Then when you go to your empty SSH Target and hit the (+) button to connect, paste in the entire ssh connection request at the top of this file. I think you have to clear out the SSH targets every time otherwise I get this error coming up again days later.

Solution 4:[4]

Windows, VSCode 1.57.1

I've just remove and added the host again in ssh configuration: enter image description here

Solution 5:[5]

If you are using MacOS, I found a way.

Close Visual Studio Code, delete files in these two folder, then restart Visual Studio Code.

rm -rf $HOME/Library/Application\ Support/Code
rm -rf $HOME/.vscode

Solution 6:[6]

I tried all solution on this post, and can't get success. Then cloned another repo on my WSL folder then open, it was fine. So I changed my repo name, then problem gone. Maybe it may dumb solution. But it works me.

Solution 7:[7]

You gonna have to change the "debug.terminal.clearBeforeReusing" to true on setting.json. It works for me

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Rodrigo Brocchi
Solution 3
Solution 4 DmitriyH
Solution 5 José Luiz Ferreira
Solution 6 ???????? ?????????
Solution 7 Rodrigo Muniz