I’m using VSCode 1.72.2 with Remote-SSH v0.90.1 on Windows to develop against an AWS EC2 VM running Ubuntu 22.04 LTS. A couple days ago, I was working in my project source folder in /opt/t4/
on the target host. When I was finished, I stopped the VM from the AWS console, forgetting that VS Code was still SSHed in.
When I brought the VM back up, I can reconnect VS Code/Remote-SSH to the host as before, except that I can no longer connect using /opt/t4/
as my working directory. I can use any directory except the one I was using when I disconnected.
I can navigate down to it and work in it if I use /opt/
as my working directory. I can navigate to it by manually SSHing to the remote host. I can create a subfolder in a remote shell at /opt/t4/test/
, and then connect VS Code using that subfolder as my working directory. I can see and select /opt/t4/
in the Open Folder dialog in VS Code. But when I try to connect using that working directory, the connection times out with a not-particularly-useful error message:
[00:05:49.867] SSH Resolver called for "ssh-remote+my.remote.host", attempt 2, (Reconnection)
[00:05:49.868] SSH Resolver called for host: my.remote.host
[00:05:49.868] Setting up SSH remote "my.remote.host"
[00:05:49.870] Using commit id "d045a5eda657f4d7b676dedbfa7aab8207f8a075" and quality "stable" for server
[00:05:49.872] Install and start server if needed
[00:05:49.874] Using SSH config file "C:Usersme.sshconfig"
[00:05:49.874] Running script with connection command: ssh -T -D 1518 -F "C:Usersme.sshconfig" "my.remote.host" bash
[00:05:49.875] Terminal shell path: C:WINDOWSSystem32cmd.exe
[00:06:06.876] Resolver error: Error: Connecting with SSH timed out
at g.Timeout (c:Usersme.vscodeextensionsms-vscode-remote.remote-ssh-0.90.1outextension.js:1:585348)
at Timeout._onTimeout (c:Usersme.vscodeextensionsms-vscode-remote.remote-ssh-0.90.1outextension.js:1:679743)
at listOnTimeout (node:internal/timers:559:17)
at process.processTimers (node:internal/timers:502:7)
[00:06:06.877] ------
- I tried
Remote-SSH: Uninstall VS Code Server from Host
from VS Code. - I tried deleting
~/.vscode-server
on the Linux host from an SSH session. - I tried
Remote-SSH: Kill VS Code Server on Host
from VS Code. - I tried
Remote-SSH: Kill Local Connection Server for Host
from VS Code. - I tried deleting and recreating the host connection details in the local config file from SSH-Remote.
- I tried rebooting both local and target hosts.
- I tried setting
/opt/
as my working dir, then deleting and recreating/opt/t4
. I was able to do this, but as soon as I try reconnecting using/opt/t4
as the working dir, VS Code still fails to connect.
I’m… stumped. My suspicion is that there is something corrupt cached Windows-side, but I don’t know where to look for that.
2
Answers
Thanks to the link from @Mike Barry, I managed to find the local workspace for that target folder and delete it to force it to reinitialize, which cleared the issue.
Deleted C:UsersmeAppDataRoamingCodeUserworkspaceStorage[guid] and reconnected with no problem.
Microsoft is aware and working on a fix. There are a variety of workarounds in this thread: https://github.com/microsoft/vscode-remote-release/issues/7324