continue icon indicating copy to clipboard operation
continue copied to clipboard

Running terminal commands in Agent mode results in an error (WSL)

Open KNChiu opened this issue 1 year ago • 23 comments

Before submitting your bug report

Relevant environment info

- OS: Win11
- Continue version: v1.0.11
- IDE version: 1.95.3
- Model: Claude Sonnet 4
- config:
  
name: Local Assistant
version: 1.0.0
schema: v1
models:
  - name: AWS Claude 4 Sonnet
    provider: bedrock
    model: us.anthropic.claude-sonnet-4-20250514-v1:0
    env:
      region: us-east-1
      profile: bedrock
    capabilities:
      - tool_use
    roles:
      - chat
      - edit
      - apply

context:
  - provider: codebase
  - provider: file
  - provider: currentFile
  - provider: code
  - provider: diff
  - provider: web
    params:
      n: 5
  - provider: terminal
  - provider: problems
  - provider: folder
  - provider: codebase
  


  OR link to assistant in Continue hub:

Description

Ask in Agent Mode: run python --version
Image

But if I press the upper right button Run, It will be automatically pasted to the terminal below but will not be executed
Image

Pressing Enter will execute correctly
Image

No response

To reproduce

No response

Log output


KNChiu avatar Jun 05 '25 01:06 KNChiu

@KNChiu I am not able to reproduce the issue. It is working properly when I ask "in bash run python --version".

Image

saimadib avatar Jun 10 '25 01:06 saimadib

@KNChiu is this still happening for you? I think we might have shipped a fix

Patrick-Erichsen avatar Jun 24 '25 20:06 Patrick-Erichsen

I tried it but still got the error. I want to ask if it is because of using wsl ?

Image

KNChiu avatar Jun 25 '25 02:06 KNChiu

WSL feels very plausible. I'm going to update the issue title accordingly and see if other folks have +1s

Patrick-Erichsen avatar Jun 25 '25 19:06 Patrick-Erichsen

I've made the following tests:

  • Open a project in WSL and tell the agent to run a command, it returns de the following output: run_terminal_command failed with the message: The URL must be of scheme file
  • Run a command directly on the terminal within WSL, it executes just fine
  • Open a project in windows and tell the agent to run a command in a windows folder it executes just fine

ezeveliz avatar Aug 07 '25 01:08 ezeveliz

@uinstinct - I forget, do you have access to a WSL machine? If so thinking this would be a good one to pick up next week if it's actually affecting all WSL folks.

Just chatted with @jpoly1219 who is on WSL and he said he also has been unable to run terminal commands.

Patrick-Erichsen avatar Aug 12 '25 20:08 Patrick-Erichsen

I work mostly through WSL, so I fixed it by adding it to the remote.extensionKind setting and force installing the extension in in WSL, but I don't think this is the best solution

ezeveliz avatar Aug 12 '25 20:08 ezeveliz

I have the same issue trying to run terminal commands in wsl.

I haven't tried installing as a remote extension.

wbontrager avatar Aug 17 '25 06:08 wbontrager

@ezeveliz What shell are you using? On my mac I'm using zsh, but continue was running commands in sh. So, they had different PATH variables.

aaceimmrttu avatar Aug 26 '25 21:08 aaceimmrttu

Just found #5996

aaceimmrttu avatar Aug 26 '25 21:08 aaceimmrttu

I have similar problem caused by using sh instead of zsh to run terminal commands.

beng90 avatar Sep 02 '25 11:09 beng90

#7437 was just merged

aaceimmrttu avatar Sep 02 '25 19:09 aaceimmrttu

I've made the following tests:

  • Open a project in WSL and tell the agent to run a command, it returns de the following output: run_terminal_command failed with the message: The URL must be of scheme file
  • Run a command directly on the terminal within WSL, it executes just fine
  • Open a project in windows and tell the agent to run a command in a windows folder it executes just fine

I have the exact results.

When I explicitly ask if it can run commands, i get this:

I'm sorry, but I can't run shell commands in your environment — the terminal tool available to me has restrictions that prevent it from connecting to your WSL/Docker setup or executing arbitrary commands.

However, I can continue helping by providing the exact commands for you to run, or by making code changes and suggestions.

Version 1.2.4

tuzumkuru avatar Sep 24 '25 04:09 tuzumkuru

I experienced the same issue when writing code remotely from my Mac to my Ubuntu desktop, connected through SSH. Telling the model to use bash did not resolve the issue. However, when I am writing code locally on my Mac, the command runs successfully.

It seems that this issue isn't limited to WSL, instead it may fail for any remote connection.

hksquinson avatar Nov 02 '25 10:11 hksquinson

I experienced the same issue when writing code remotely from my Mac to my Ubuntu desktop, connected through SSH. Telling the model to use bash did not resolve the issue. However, when I am writing code locally on my Mac, the command runs successfully.

It seems that this issue isn't limited to WSL, instead it may fail for any remote connection.

I can confirm this, i get the same error when running VS Code on my windows host, but operating in a debian remote ssh environment

northernpowerhouse avatar Nov 17 '25 09:11 northernpowerhouse

Another +1 here: VSCode installed on Windows, talking with LM Studio (installed on Windows), editing code in an Ubuntu WSL directory.

It can edit, create*, and read files just fine. *so long as the parent directory already exists!

But it appears to fail at creating directories or running terminal commands:

Image

The specific errors I got for creating a new file in a new directory:

create_new_file failed with the message: `filepath` argument is required and must not be empty or whitespace-only. (type string)

Please try something else or request further instructions.

Edit: I should also point out that I'm using .zsh instead of the default bash.

Edit again: There exists a potential workaround, as discussed in #8091. I posted my notes here.

ad08fee3 avatar Nov 18 '25 17:11 ad08fee3

I have a linux laptop with a VSC remote server connection and the agent also is not able to run commands on remote server.

emilations avatar Feb 02 '26 02:02 emilations

related https://github.com/continuedev/continue/pull/10786

RomneyDa avatar Mar 24 '26 00:03 RomneyDa

Fixed by https://github.com/continuedev/continue/pull/10538

RomneyDa avatar Mar 24 '26 00:03 RomneyDa

Agent commands in WSL are still not working when opening projects in IntelliJ -- I have proposed a change to add support via this PR https://github.com/continuedev/continue/pull/12442

GabeChurch avatar May 20 '26 15:05 GabeChurch