'VS CODE remote-ssh `code` command not working properly

I connect to the remote server with vs code command invoked by CTRL+SHIFT+P Remote-SSH: Connect to Host.... Everything works fine. After some time when I try to open a new file from the vs-code terminal with the code command, I will get this error message:

/some/path/on/remote$ code some_existing_file.py                                                                                         
Unable to connect to VS Code server: Error in request.
Error: connect ENOENT /run/user/1006/vscode-ipc-789269cc-6026-4d15-8ca6-<i_changed_this>.sock
    at PipeConnectWrap.afterConnect [as oncomplete] (node:net:1161:16) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'connect',
  address: '/run/user/1001/vscode-ipc-789269cc-6026-4d15-8ca6-<i_changed_this>.sock'
}

Killing all running vs-code processes manually "solves" the problem. The occurence of this problem seems to be random. Sometimes it happens 3 times within an hour, sometimes just once per day.

vs-code version: 1.66.0

Any suggestion on how to solve this issue?



Solution 1:[1]

I was having similar issue and error message when running code .

The solution worked for me was to remove everything under the HOME's .vscode-server directory

rm -rf ~/.vscode-server

Now do the code xxx command again should re-install the VS Code Server under the .vscode-server folder.

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 LeOn - Han Li