Skip to content

Cannot re-connect to windows host #11403

Open
microsoft/vscode
#328660

Description

Is there an existing issue for this bug?

  • I have searched the existing open issues and found none that apply.
  • If I find any issue of interest that is related or closed, I will included a link to it in this issue.

Required Troubleshooting Steps

  • I have read and performed the troubleshooting steps
  • I have tried both values of the remote.SSH.useLocalServer setting
  • My issue was not covered in the Tips and Tricks linked from the Troubleshooting Wiki.
  • I will include a complete copy of my Remote - SSH logs by running Remote-SSH: Show Log in the command palette or from View > Output in the menu bar

[Optional] Diagnose with Copilot

I did not ask the @remote-ssh participant for help

In step 2 of the troubleshooting wiki, what was the result of running the generated SSH command verbatim outside of VS Code?

I COULD successfully SSH to the remote machine with the generated SSH command

Remote-SSH Log

Remote-SSH Log

[12:48:44.125] Log Level: 2
[12:48:44.139] VS Code version: 1.107.1
[12:48:44.139] Remote-SSH version: remote-ssh@0.122.0
[12:48:44.139] darwin arm64
[12:48:44.145] SSH Resolver called for "ssh-remote+windows", attempt 1
[12:48:44.149] remote.SSH.useLocalServer = true
[12:48:44.149] remote.SSH.useExecServer = true
[12:48:44.149] remote.SSH.bindHost = {}
[12:48:44.149] remote.SSH.path =
[12:48:44.150] remote.SSH.configFile =
[12:48:44.150] remote.SSH.useFlock = true
[12:48:44.150] remote.SSH.lockfilesInTmp = false
[12:48:44.151] remote.SSH.localServerDownload = auto
[12:48:44.151] remote.SSH.remoteServerListenOnSocket = false
[12:48:44.151] remote.SSH.defaultExtensions = ["ms-python.python","ms-python.vscode-pylance"]
[12:48:44.151] remote.SSH.defaultExtensionsIfInstalledLocally = []
[12:48:44.151] remote.SSH.loglevel = 2
[12:48:44.151] remote.SSH.maxReconnectionAttempts = 2
[12:48:44.151] remote.SSH.enableDynamicForwarding = true
[12:48:44.151] remote.SSH.enableRemoteCommand = false
[12:48:44.151] remote.SSH.serverPickPortsFromRange = {}
[12:48:44.152] remote.SSH.serverInstallPath = {}
[12:48:44.152] remote.SSH.permitPtyAllocation = false
[12:48:44.152] remote.SSH.preferredLocalPortRange = undefined
[12:48:44.152] remote.SSH.useCurlAndWgetConfigurationFiles = false
[12:48:44.152] remote.SSH.experimental.chat = true
[12:48:44.152] remote.SSH.experimental.enhancedSessionLogs = true
[12:48:44.152] remote.SSH.httpProxy = {"*":""}
[12:48:44.152] remote.SSH.httpsProxy = {"*":""}
[12:48:44.160] SSH Resolver called for host: windows
[12:48:44.160] Setting up SSH remote "windows"
[12:48:44.166] Acquiring local install lock: /var/folders/5y/hhvf46cx393_j75q4gm7tvzw0000gq/T/vscode-remote-ssh-d59726ea-install.lock
[12:48:44.168] Looking for existing server data file at /Users/tekumara/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-d59726ea-994fd12f8d3a5aa16f17d42c041e5809167e845a-0.122.0-es/data.json
[12:48:44.169] Found existing data file
[12:48:44.169] Found local server running: {"remoteListeningOn":{"port":60468},"osReleaseId":"windows","arch":"x64","sshAuthSock":"","platform":"windows","execServerToken":"1f5848b1-f677-423b-8af8-5163a2228d94","pid":73828,"ipcHandlePath":"/var/folders/5y/hhvf46cx393_j75q4gm7tvzw0000gq/T/vscode-ssh-askpass-feb6f15e39f2dfd0bc44c14caa724bca1ded23b5.sock","socksPort":49183,"startupTime":1767404550505}
[12:48:44.175] Found running server - short-circuiting install
[12:48:44.177] Starting forwarding server. local port 50121 -> socksPort 49183 -> remotePort 60468
[12:48:44.179] Forwarding server listening on port 50121
[12:48:44.179] Waiting for ssh tunnel to be ready
[12:48:44.180] [Forwarding server port 50121] Got connection 0
[12:48:44.181] Tunneled port 60468 to local port 50121
[12:48:44.181] Resolved "ssh-remote+windows" to "port 50121"
[12:48:44.186] Initizing new exec server for ssh-remote+windows
[12:48:44.186] Resolving exec server at port 50121
[12:48:44.187] [Forwarding server port 50121] Got connection 1
[12:48:44.226] Exec server for ssh-remote+windows created and cached
[12:48:44.226] Extensions to install: ms-python.python, ms-python.vscode-pylance
[12:48:44.230] ------




[12:48:44.231] No hints found in the recent session.
[12:48:44.314] [server] Checking C:\Users\Quickemu\.vscode-server\cli\servers\Stable-994fd12f8d3a5aa16f17d42c041e5809167e845a\log.txt and C:\Users\Quickemu\.vscode-server\cli\servers\Stable-994fd12f8d3a5aa16f17d42c041e5809167e845a\pid.txt for a running server...
[12:48:44.315] [server] Found running server (pid=4512)
[12:48:44.320] [server] Installing extensions...
[12:48:44.589] [server] Checking C:\Users\Quickemu\.vscode-server\cli\servers\Stable-994fd12f8d3a5aa16f17d42c041e5809167e845a\log.txt and C:\Users\Quickemu\.vscode-server\cli\servers\Stable-994fd12f8d3a5aa16f17d42c041e5809167e845a\pid.txt for a running server...
[12:48:44.589] [server] Found running server (pid=4512)
[12:48:44.590] [server] Installing extensions...
[12:48:44.693] [server] Checking C:\Users\Quickemu\.vscode-server\cli\servers\Stable-994fd12f8d3a5aa16f17d42c041e5809167e845a\log.txt and C:\Users\Quickemu\.vscode-server\cli\servers\Stable-994fd12f8d3a5aa16f17d42c041e5809167e845a\pid.txt for a running server...
[12:48:44.693] [server] Found running server (pid=4512)
[12:48:44.693] [server] Installing extensions...
[12:48:44.695] ------




[12:48:44.695] SSH Resolver called for "ssh-remote+windows", attempt 2, (Reconnection)
[12:48:44.696] SSH Resolver called for host: windows
[12:48:44.696] Setting up SSH remote "windows"
[12:48:44.697] Acquiring local install lock: /var/folders/5y/hhvf46cx393_j75q4gm7tvzw0000gq/T/vscode-remote-ssh-d59726ea-install.lock
[12:48:44.698] Looking for existing server data file at /Users/tekumara/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-d59726ea-994fd12f8d3a5aa16f17d42c041e5809167e845a-0.122.0-es/data.json
[12:48:44.699] Found existing data file
[12:48:44.699] Found local server running: {"remoteListeningOn":{"port":60468},"osReleaseId":"windows","arch":"x64","sshAuthSock":"","platform":"windows","execServerToken":"1f5848b1-f677-423b-8af8-5163a2228d94","pid":73828,"ipcHandlePath":"/var/folders/5y/hhvf46cx393_j75q4gm7tvzw0000gq/T/vscode-ssh-askpass-feb6f15e39f2dfd0bc44c14caa724bca1ded23b5.sock","socksPort":49183,"startupTime":1767404550505}
[12:48:44.699] Running server is stale. Ignoring
[12:48:44.699] Using commit id "994fd12f8d3a5aa16f17d42c041e5809167e845a" and quality "stable" for server
[12:48:44.700] Extensions to install: ms-python.python, ms-python.vscode-pylance
[12:48:44.705] Install and start server if needed
[12:48:44.708] PATH: ... 
[12:48:44.708] Checking ssh with "ssh -V"
[12:48:44.723] > OpenSSH_10.0p2, LibreSSL 3.3.6

[12:48:44.726] askpass server listening on /var/folders/5y/hhvf46cx393_j75q4gm7tvzw0000gq/T/vscode-ssh-askpass-978e31c971f71ebb2e52857a4d56281c10a19205.sock
[12:48:44.727] Spawning local server with {"serverId":1,"ipcHandlePath":"/var/folders/5y/hhvf46cx393_j75q4gm7tvzw0000gq/T/vscode-ssh-askpass-79d35f013ba9e613d3d66ef7cdcb3f96fa7db9e2.sock","sshCommand":"ssh","sshArgs":["-v","-T","-D","50127","-o","ConnectTimeout=60","windows","powershell"],"serverDataFolderName":".vscode-server","dataFilePath":"/Users/tekumara/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-d59726ea-994fd12f8d3a5aa16f17d42c041e5809167e845a-0.122.0-es/data.json"}
[12:48:44.727] Local server env: {"SSH_AUTH_SOCK":"/private/tmp/com.apple.launchd.bg3s6t7420/Listeners","SHELL":"/bin/zsh","DISPLAY":"1","ELECTRON_RUN_AS_NODE":"1","SSH_ASKPASS":"/Users/tekumara/.vscode/extensions/ms-vscode-remote.remote-ssh-0.122.0/out/local-server/askpass.sh","VSCODE_SSH_ASKPASS_NODE":"/Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper (Plugin).app/Contents/MacOS/Code Helper (Plugin)","VSCODE_SSH_ASKPASS_EXTRA_ARGS":"","VSCODE_SSH_ASKPASS_MAIN":"/Users/tekumara/.vscode/extensions/ms-vscode-remote.remote-ssh-0.122.0/out/askpass-main.js","VSCODE_SSH_ASKPASS_HANDLE":"/var/folders/5y/hhvf46cx393_j75q4gm7tvzw0000gq/T/vscode-ssh-askpass-978e31c971f71ebb2e52857a4d56281c10a19205.sock"}
[12:48:44.728] Spawned 76673
[12:48:44.729] Using connect timeout of 62 seconds
[12:48:44.846] > local-server-1> Running ssh connection command: ssh -v -T -D 50127 -o ConnectTimeout=60 windows powershell
[12:48:44.848] > local-server-1> Spawned ssh, pid=76681
[12:48:46.431] stderr> debug1: Server host key: ssh-ed25519 SHA256:q1uMM4sdD/YBS+ZBe636bLJXfwFtaAhSjGTEgCwmTFU
[12:48:46.644] stderr> Authenticated to beebop.local ([192.168.68.112]:22220) using "publickey".
[12:48:48.965] > Windows PowerShell
> Copyright (C) Microsoft Corporation. All rights reserved.
>
> Install the latest PowerShell for new features and improvements! https://aka.ms/PSWindows
[12:48:49.181] Exec server for ssh-remote+windows closed (gracefully)
[12:48:51.021] > PS C:\Users\Quickemu>
[12:48:51.362] > echo 'ready: 98a5ea234621'
[12:48:52.493] > ready: 98a5ea234621
[12:48:52.531] > PS C:\Users\Quickemu>
[12:48:52.534] > uname -rsv
[12:48:52.830] > MSYS_NT-10.0-26200 3.6.5-22c95533.x86_64 2025-10-10 12:02 UTC
[12:48:52.831] Platform: windows
[12:48:52.831] Remote command length: 6676/8192 characters
[12:48:52.837] > PS C:\Users\Quickemu>
[12:48:52.841] > powershell -NoProfile
[12:48:53.046] > Windows PowerShell
> Copyright (C) Microsoft Corporation. All rights reserved.
>
> Install the latest PowerShell for new features and improvements! https://aka.ms/PSWindows
[12:48:53.047] >
[12:48:54.889] > PS C:\Users\Quickemu>
[12:48:55.397] > powershell -ExecutionPolicy Unrestricted -NoLogo -NoProfile -NonInteractive -Command "`$remoteSSHConfigurationScript=[Convert]::ToBase64String([Text.Encoding]::Unicode.GetBytes([Text.Encoding]::UTF8.GetString([Con
[12:48:55.399] > vert]::FromBase64String('CiR1dWlkPSI5OGE1ZWEyMzQ2MjEiCiIke3V1aWR9OiBydW5uaW5nIgoi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cmlwdFN0YWNrVHJhY2UpIgp9CnRyeSB7CiRnbG9iYWw6YWlfID0gKGdjaW0gV2luMzJfT3BlcmF0aW5nU3lzdGVtKS5WZXJzaW9uCn0gY2F0Y2ggewoiRmFpbGVkIHRvIGZpbmQgV2luZG93cyB2ZXJzaW9uIC0gJCgkXy5Ub1N0cmluZygpKSIKJGdsb2JhbDphaV8gPSAidW5rbm93biIKfQpwcmludFJlc3VsdAoiJHBpZCwgd2F0Y2hpbmcgJHNzaGRQSUQiCndoaWxlICgkVHJ1ZSkgewpiXwpzbGVlcCAzMAp9Cn0KIjk4YTVlYTIzNDYyMTogcmVzdW1lTG9nIgptYWluCg==')))); powershell -ExecutionPolicy Unrestricted -NoLogo -NoProfile -NonInteractive -EncodedCommand `$remoteSS
[12:48:55.420] > HConfigurationScript"
[12:48:57.060] > 98a5ea234621: running
> 98a5ea234621: pauseLog
[12:48:59.222] > 98a5ea234621: resumeLog
[12:49:00.913] > Looking for existing CLI in C:\Users\Quickemu\.vscode-server
> Found installed CLI
[12:49:00.943] > Starting cli: & 'C:\Users\Quickemu\.vscode-server\code-994fd12f8d3a5aa16f17d42c041e5809167e845a.exe' command-shell --cli-data-dir 'C:\Users\Quickemu\.vscode-server\cli' --parent-process-id 9340 --on-host 127.0.0.1 --on-port --require-token 062fd825-c43d-4d45-88da-c5ecf262972c *> 'C:\Users\Quickemu\AppData\Local\Temp\tmpDD7E.tmp'
[12:49:02.881] > 98a5ea234621: start
[12:49:02.889] > SSH_AUTH_SOCK====
> listeningOn==52251==
> osReleaseId==windows==
[12:49:02.896] >
> osVersion==10.0.26200==
> arch==x64==
> platform==windows==
> unpackResult====
> didLocalDownload==False==
> downloadTime====
> installTime====
> extInstallTime====
> serverStartTime==277==
> execServerToken==111aa111-a11a-1a11-11aa-a1aaa111111a==
[12:49:02.897] > 98a5ea234621: end
> 3544, watching 9340
[12:49:02.897] Received install output: SSH_AUTH_SOCK====
listeningOn==52251==
osReleaseId==windows==
osVersion==10.0.26200==
arch==x64==
platform==windows==
unpackResult====
didLocalDownload==False==
downloadTime====
installTime====
extInstallTime====
serverStartTime==277==
execServerToken==111aa111-a11a-1a11-11aa-a1aaa111111a==
[12:49:02.898] Remote server is listening on port 52251
[12:49:02.898] Parsed server configuration: {"serverConfiguration":{"remoteListeningOn":{"port":52251},"osReleaseId":"windows","arch":"x64","sshAuthSock":"","platform":"windows","execServerToken":"111aa111-a11a-1a11-11aa-a1aaa111111a"},"serverStartTime":277,"installUnpackCode":""}
[12:49:02.899] Persisting server connection details to /Users/tekumara/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-d59726ea-994fd12f8d3a5aa16f17d42c041e5809167e845a-0.122.0-es/data.json
[12:49:02.901] Starting forwarding server. local port 50171 -> socksPort 50127 -> remotePort 52251
[12:49:02.902] Forwarding server listening on port 50171
[12:49:02.902] Waiting for ssh tunnel to be ready
[12:49:02.903] [Forwarding server port 50171] Got connection 0
[12:49:02.903] Tunneled port 52251 to local port 50171
[12:49:02.903] Resolved "ssh-remote+windows" to "port 50171"
[12:49:02.904] Initizing new exec server for ssh-remote+windows
[12:49:02.904] Resolving exec server at port 50171
[12:49:02.904] [Forwarding server port 50171] Got connection 1
[12:49:02.945] Exec server for ssh-remote+windows created and cached
[12:49:02.945] Extensions to install: ms-python.python, ms-python.vscode-pylance
[12:49:02.947] ------




[12:49:02.947] No hints found in the recent session.
[12:49:02.963] [server] Checking C:\Users\Quickemu\.vscode-server\cli\servers\Stable-994fd12f8d3a5aa16f17d42c041e5809167e845a\log.txt and C:\Users\Quickemu\.vscode-server\cli\servers\Stable-994fd12f8d3a5aa16f17d42c041e5809167e845a\pid.txt for a running server...
[12:49:02.964] [server] Found running server (pid=4512)
[12:49:02.964] [server] Installing extensions...
[12:49:03.111] [server] Checking C:\Users\Quickemu\.vscode-server\cli\servers\Stable-994fd12f8d3a5aa16f17d42c041e5809167e845a\log.txt and C:\Users\Quickemu\.vscode-server\cli\servers\Stable-994fd12f8d3a5aa16f17d42c041e5809167e845a\pid.txt for a running server...
[12:49:03.111] [server] Found running server (pid=4512)
[12:49:03.112] [server] Installing extensions...
[12:49:03.231] ------

... tries again up 5 attempts ...

Expected Behavior

Can re-connect to running vs code server on windows host

Actual Behavior

Fails to connect second time with:

Failed to connect to the remote extension host server (Error: ExtensionInstallFailed(ExtensionInstallFailed("bash: line 1: C:UsersQuickemu.vscode-servercliserversStable-994fd12f8d3a5aa16f17d42c041e5809167e845aserverbincode-server.cmd: command not found\n")))

Steps To Reproduce

  1. On the local client, set the remote platform as windows:
       "remote.SSH.remotePlatform": {
        "windows-remote-host-name": "windows"
      }
  2. Connect to the Windows remote host - the first time it works
  3. Reload Window or open a new window and connect - it doesn't work

Anything else?

No response

Activity

  1. changed the title [-]Cannot connect to windows host with Windows powershell as default shell[/-] [+]Cannot connect to windows host[/+] on Jan 3, 2026
  2. changed the title [-]Cannot connect to windows host[/-] [+]Cannot re-connect to windows host[/+] on Jan 3, 2026
  3. changed the title [-]Cannot re-connect to windows host[/-] [+]Cannot connect to windows host[/+] on Jan 3, 2026
  4. changed the title [-]Cannot connect to windows host[/-] [+]Cannot re-connect to windows host[/+] on Jan 3, 2026
  5. tekumara commented on Jan 3, 2026

    @tekumara
    Author

    The logs above show its trying to connect to the running server:

    [12:48:44.315] [server] Found running server (pid=4512)
    [12:48:44.320] [server] Installing extensions...
    

    If I kill the running server first, I can connect:

    taskkill /PID 4512 /F
    
  6. GoshawkGGGG commented on Mar 23, 2026

    @GoshawkGGGG

    I also encountered the same issue where it was impossible to reconnect to the Windows server. In my case, an error occurred stating that the remote environment could not be accessed. Additionally, the plugin attempted to execute bash commands on the Windows server by default, which resulted in another error indicating that the bash program was not found. The connection could only be established after the first SSH attempt timed out and was interrupted. It seems that the problem is related to the configuration files, which become inaccessible after the initial connection is established and the connection is maintained.

  7. GoshawkGGGG commented on Mar 23, 2026

    @GoshawkGGGG

    I also encountered the same issue where it was impossible to reconnect to the Windows server. In my case, an error occurred stating that the remote environment could not be accessed. Additionally, the plugin attempted to execute bash commands on the Windows server by default, which resulted in another error indicating that the bash program was not found. The connection could only be established after the first SSH attempt timed out and was interrupted. It seems that the problem is related to the configuration files, which become inaccessible after the initial connection is established and the connection is maintained.

    New discovery: To fix this issue, I just need to disable “Remote.SSH: Use Exec Server”.

  8. arloor commented on Aug 3, 2026

    @arloor

    I believe the root cause is in the VS Code CLI implementation rather than in Remote-SSH's SSH transport.

    When reconnecting, ServerBuilder::get_running() detects the existing server and unconditionally calls do_extension_install_on_running_server() if install_extensions is non-empty:

    https://github.com/microsoft/vscode/blob/d5dd3ab69669226d4a7d4819cad108ebdd6d7708/cli/src/tunnels/code_server.rs#L393-L417

    let pid = match self.server_paths.get_running_pid() {
        Some(pid) => pid,
        None => return Ok(None),
    };
    
    info!(self.logger, "Found running server (pid={})", pid);
    
    do_extension_install_on_running_server(
        &self.server_paths.executable,
        &self.server_params.code_server_args.install_extensions,
        self.logger,
    )
    .await?;

    The suspicious part is inside do_extension_install_on_running_server():

    https://github.com/microsoft/vscode/blob/d5dd3ab69669226d4a7d4819cad108ebdd6d7708/cli/src/tunnels/code_server.rs#L314-L343

    let command = format!(
        "{} {}",
        start_script_path.display(),
        extensions
            .iter()
            .map(|s| get_extensions_flag(s))
            .collect::<Vec<String>>()
            .join(" ")
    );
    
    let result = capture_command("bash", &["-c", &command]).await?;

    This code always invokes bash, including when the CLI is running on Windows.

    On a Windows remote, start_script_path is a path similar to:

    C:\Users\<user>\.vscode-server\cli\servers\Stable-<commit>\server\bin\code-server.cmd
    

    Therefore, during reconnection the implementation effectively tries to execute a Windows .cmd file through:

    bash -c "C:\Users\...\code-server.cmd --install-extension=..."
    

    This explains both observed errors:

    1. If Git Bash is present, the backslashes in the Windows path are consumed/interpreted by Bash, resulting in the C:Users...code-server.cmd: command not found error reported in this issue.
    2. If bash resolves to an inaccessible Windows app execution alias, spawning it fails with CodeError(CommandFailed { command: "bash", code: -1, output: "The file cannot be accessed by the system. (os error 1920)" }).

    It also explains why:

    • the first connection succeeds;
    • reconnecting to an already-running server fails;
    • the log stops after Found running server / Installing extensions...;
    • clearing remote.SSH.defaultExtensions avoids the problem;
    • disabling remote.SSH.useExecServer avoids this code path.

    The same codebase already provides a platform-aware new_script_command() helper, which uses cmd /Q /C on Windows:

    https://github.com/microsoft/vscode/blob/d5dd3ab69669226d4a7d4819cad108ebdd6d7708/cli/src/util/command.rs#L87-L103

    #[cfg(windows)]
    pub fn new_script_command(script: impl AsRef<OsStr>) -> Command {
        let mut cmd = new_tokio_command("cmd");
        cmd.arg("/Q");
        cmd.arg("/C");
        cmd.arg(script);
        cmd
    }

    Would it make sense for do_extension_install_on_running_server() to use new_script_command(start_script_path) and pass the extension flags as individual arguments, instead of constructing a shell command string and invoking bash -c unconditionally?

    For example, conceptually:

    let mut command = new_script_command(start_script_path);
    command.args(extensions.iter().map(|s| get_extensions_flag(s)));
    
    let result = command.output().await?;

    This would also avoid shell escaping issues for server paths containing spaces or other special characters.

  9. arloor commented on Aug 3, 2026

    @arloor

    While waiting for microsoft/vscode#328660 to reach a Stable release, I tested a temporary workaround that keeps the official VS Code CLI unchanged: place a small, restricted bash.exe shim next to the remote CLI.

    Why this works

    The official remote CLI is located at:

    %USERPROFILE%\.vscode-server\code-<commit>.exe
    

    When that CLI executes Command::new("bash"), Windows searches the calling application's directory before the PATH locations, so it finds:

    %USERPROFILE%\.vscode-server\bash.exe
    

    before the inaccessible WindowsApps alias. See the CreateProcess executable search order.

    Restricted shim design

    This is not a general Bash implementation or a general Bash-to-CMD translator. The shim accepts only the invocation currently made by the reconnect path:

    bash.exe -c "C:\Users\<user>\.vscode-server\cli\servers\<any-version>\server\bin\code-server.cmd --install-extension=<id> ..."
    

    It validates that:

    1. the arguments are exactly -c <command>;
    2. the script is under %USERPROFILE%\.vscode-server\cli\servers\<one-directory>\server\bin\code-server.cmd;
    3. every remaining argument is an --install-extension=<id> flag.

    It then delegates to the Windows-native runner:

    let status = Command::new("cmd.exe")
        .args(["/D", "/Q", "/C"])
        .arg(script)
        .args(extension_flags)
        .status()?;

    The check intentionally does not pin a VS Code commit, so it can continue to work for later versions while they still contain the unconditional bash -c call. Unexpected scripts or arguments are rejected instead of being passed to cmd.exe.

    I compiled the shim as a statically linked Windows executable and installed it as:

    %USERPROFILE%\.vscode-server\bash.exe
    

    Test result

    Tested with VS Code 1.131.0, Remote-SSH 0.124.0, and a Windows 11 x64 remote:

    • first connection started the server and installed the configured extensions successfully;
    • reloading the window entered the affected reconnect path;
    • the second log contained Found running server followed by Installing extensions...;
    • the exec server was then opened and reused successfully;
    • there was no CommandFailed, bash error, or os error 1920.

    This is only a local workaround. Once microsoft/vscode#328660 is included in the installed Stable version, the shim should be disabled or removed.

  10. removed their assignment
    on Sep 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    sshIssue in vscode-remote SSH

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions