zed-industries/zed · error

failed to run command {command:?}: {}

Error message

failed to run command {command:?}: {}

What it means

In SshRemoteConnection::run_command: the assembled `ssh` command exited non-zero; ensure! raises this error embedding the command and its output. Covers any failing remote shell invocation (probe, os version, shell detection, etc.).

Source

Thrown at crates/remote/src/transport/ssh.rs:1395

        if !allow_pseudo_tty {
            command.arg("-T");
        }
        command.arg(to_run);
        log::debug!("ssh {:?}", command);
        command
    }

    async fn run_command(
        &self,
        shell_kind: ShellKind,
        program: &str,
        args: &[impl AsRef<str>],
        allow_pseudo_tty: bool,
    ) -> Result<String> {
        let mut command = self.ssh_command(shell_kind, program, args, allow_pseudo_tty);
        let output = command.output().await?;
        log::debug!("{:?}: {:?}", command, output);
        anyhow::ensure!(
            output.status.success(),
            "failed to run command {command:?}: {}",
            String::from_utf8_lossy(&output.stderr)
        );
        Ok(String::from_utf8_lossy(&output.stdout).to_string())
    }

    fn ssh_options<'a>(
        &self,
        command: &'a mut util::command::Command,
        include_port_forwards: bool,
        deny_args: Option<&[&str]>,
    ) -> &'a mut util::command::Command {
        let mut args = if include_port_forwards {
            self.connection_options.additional_args()
        } else {
            self.connection_options.additional_args_for_scp()
        };

View on GitHub (pinned to f4178619ac)

Solutions

  1. Verify SSH connectivity and credentials to the host
  2. Inspect the included output for the remote error
  3. Check that the remote shell isn't blocking non-interactive commands
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at crates/remote/src/transport/ssh.rs:1395 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20). Data as JSON: /api/errors/20557f873039f996. Report an issue: GitHub.