Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 871
Petr Dvořáček Avatar asked Aug 10 '26 11:08

Petr Dvořáček


2 Answers

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.

like image 99
LeOn - Han Li Avatar answered Aug 12 '26 06:08

LeOn - Han Li


It's caused by the client connecting to an outdated socket. To simply solve this, just SSH into the server, and kill all processes for VS code:

ps -fu $USER | grep vscode | grep -v grep | awk '{print $2}' | xargs kill

Then you can restart VS code (with remote SSH) and try again.

like image 37
Yu Sun Avatar answered Aug 12 '26 06:08

Yu Sun



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!