visual-studio-codevscode-remote-ssh

VS Code Remote-SSH won't reconnect to one specific working directory on remote Ubuntu host


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:\Users\me\.ssh\config"
[00:05:49.874] Running script with connection command: ssh -T -D 1518 -F "C:\Users\me\.ssh\config" "my.remote.host" bash
[00:05:49.875] Terminal shell path: C:\WINDOWS\System32\cmd.exe
[00:06:06.876] Resolver error: Error: Connecting with SSH timed out
    at g.Timeout (c:\Users\me\.vscode\extensions\ms-vscode-remote.remote-ssh-0.90.1\out\extension.js:1:585348)
    at Timeout._onTimeout (c:\Users\me\.vscode\extensions\ms-vscode-remote.remote-ssh-0.90.1\out\extension.js:1:679743)
    at listOnTimeout (node:internal/timers:559:17)
    at process.processTimers (node:internal/timers:502:7)
[00:06:06.877] ------

I'm... stumped. My suspicion is that there is something corrupt cached Windows-side, but I don't know where to look for that.


Solution

  • 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:\Users\me\AppData\Roaming\Code\User\workspaceStorage\[guid]\ and reconnected with no problem.