Skip to content

run_terminal_command fails with "spawn powershell.exe ENOENT" via SSH Remote from Windows #10462

Closed

Description

@shanevcantwell

Before submitting your bug report

Relevant environment info

- OS: Windows 11 (host) → Ubuntu 24.04 (remote via SSH)
- Continue version: v1.3.31 pre-release
- IDE version: VS Code 1.96+ with Remote-SSH extension
- Model: nvidia/nemotron-3-nano-30b-a3b via LM Studio
- Connection: VS Code Remote-SSH to Linux host

Note

Filing this for searchability — this is the SSH Remote variant of #9661 (WSL) and #10007 (WSL/Dev Container). We reproduced it while testing tool overrides over an SSH tunnel and realized the scenario wasn't documented as its own issue. PR #10391 (already merged) fixes this, so this can be closed at your convenience. Apologies for the extra triage work — just wanted a findable record for anyone hitting this specific error via SSH Remote.

Description

When VS Code on Windows connects to a Linux host via SSH Remote, run_terminal_command fails immediately:

run_terminal_command failed with the message: spawn powershell.exe ENOENT

Root cause: extensionKind: ["ui", "workspace"] runs the Continue extension on the Windows host. getShellCommand() checks process.platform, gets "win32", and returns powershell.exe — but the command should execute on the remote Linux host where powershell.exe does not exist.

To reproduce

  1. Open VS Code on Windows
  2. Connect to a Linux host via Remote-SSH
  3. Open a workspace on the remote host
  4. In Continue chat, ask the model to run any terminal command (e.g., pwd)
  5. Observe: spawn powershell.exe ENOENT

Resolution

Fixed by #10391, which generalizes Windows remote detection to all remote types (WSL, SSH, Dev Container, Codespaces, tunnels):

const isWindowsHostWithRemote =
  process.platform === "win32" && !["", "local"].includes(ideInfo.remoteName);

When true, the implementation delegates to ide.runCommand() instead of spawning a local shell.

Related: #9661, #10007, #8826, #10433

Log output

run_terminal_command failed with the message: spawn powershell.exe ENOENT

Activity

  1. added
    ide:vscode
    kind:bug
    os:windows
    on Feb 12, 2026
  2. dochy-ksti commented on Feb 14, 2026

    @dochy-ksti

    I couldn't reproduce this, but I also saw this message.

    I made a mcp server for shell

    name: Local Config
    version: 1.0.0
    schema: v1
    models:
      - name: "QwQ-32B"
        provider: "ollama"
        model: "qwq:32b"
        apiBase: "http://192.168.1.73:11434"
    
    mcpservers:
      - name: shell
        command: npx
        args:
          - "-y"
          - "@modelcontextprotocol/server-shell"
    

    and I sent the message "shell機能を使ってlsを実行して"(run ls command with shell function) to the the agent.

    The prompt which wanted to run command "ls" appeared and I accepted.

    The output is

    $ ls
    
    run_terminal_command failed with the message: spawn powershell.exe ENOENT
    
    • OS: Windows 11 (host) → Ubuntu 24.04 (remote via SSH)
    • Continue version: v1.3.31 pre-release
    • IDE version: VS Code 1.109.3+ with Remote-SSH extension
    • Model: QwQ:32B via Ollama
    • Connection: VS Code Remote-SSH to Linux host
  3. emilations commented on Feb 15, 2026

    @emilations

    I wish this could also be implemented from linux host to linux server as well.

  4. shanevcantwell commented on Feb 15, 2026

    @shanevcantwell
    ContributorAuthor

    I wish this could also be implemented from linux host to linux server as well.

    Are you getting a spawn powershell.exe error when going from linux->linux? It looks like maybe you could be still looking at your host's filesystem and not the server's. Is that the symptom?

  5. emilations commented on Feb 15, 2026

    @emilations

    I wish this could also be implemented from linux host to linux server as well.

    Are you getting a spawn powershell.exe error when going from linux->linux? It looks like maybe you could be still looking at your host's filesystem and not the server's. Is that the symptom?

    The error I get is:

    run_terminal_command failed with the message: spawn /bin/sh ENOENT
    
    Please try something else or request further instructions.
    
  6. shanevcantwell commented on Feb 15, 2026

    @shanevcantwell
    ContributorAuthor

    I'll look into it. This fix doesn't fully address it yet.

  7. shanevcantwell commented on Feb 16, 2026

    @shanevcantwell
    ContributorAuthor

    It's part of a pattern that has improved for the Windows->WSL side as with #10538. This expands that fix even further to all remote environments. The pattern had good intent (#10542) but unfortunately causes problems with remote environments such as wsl and containers that render the terminal command tool unusable.

  8. martianrock commented on Feb 17, 2026

    @martianrock

    This error also happens in devcontainer. run_terminal_command failed with the message: spawn /bin/sh ENOENT. /bin/sh is present in both host and container.

  9. shanevcantwell commented on Mar 4, 2026

    @shanevcantwell
    ContributorAuthor

    @martianrock Confirmed — Dev Containers hit the same spawn ENOENT as SSH and WSL. The extension runs in the Local Extension Host on Windows, so child_process.spawn() tries to execute the remote shell locally.

    Two open PRs fix this:

  10. luoxinkaikevin commented on Mar 17, 2026

    @luoxinkaikevin

    @shanevcantwell
    I also meet the same problem when using SSH. Is there any new progress about this issue.
    Thanks a lot in advance!

  11. avlis commented on Mar 17, 2026

    @avlis

    Also happens from vscode in macos -> remote-ssh to a linux server.
    $ echo $HOSTNAME
    run_terminal_command failed with the message: spawn /bin/bash ENOENT

  12. avlis commented on Mar 17, 2026

    @avlis

    and edit_existing_file also seems to have issues, not sure if relates to this or not.

  13. shanevcantwell commented on Mar 18, 2026

    @shanevcantwell
    ContributorAuthor

    @luoxinkaikevin @avlis — #10538 restricts childProcess.spawn to local-only environments and routes remote terminals through ide.runCommand() instead. We've tested it on both SSH and WSL remotes and it resolves the ENOENT. #10786 would then add output capture on top of that.

  14. RomneyDa commented on Mar 25, 2026

    @RomneyDa
    Contributor

    Fixed by #10538

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

    ide:vscodekind:bugos:windows

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions