jdx/mise · error · eyre::Report

remote command on '{name}' failed with {}: {}

Error message

remote command on '{name}' failed with {}: {}

What it means

A command run over SSH on a remote host (identified by its configured remote name) exited with a non-zero status. mise runs several probes and setup commands on the remote (mktemp staging creation, login-shell probes like 'command -v mise', staging cleanup, '<staging>/mise version'), and every one goes through checked_output, so this error surfaces the remote exit code plus the remote's trimmed stderr.

Source

Thrown at src/system/remote.rs:1590

        if status.is_ok_and(|status| !status.success()) {
            debug!(
                "SSH control connection for {} was already closed",
                self.host.name
            );
        }
    }
}

impl Drop for SshSession<'_> {
    fn drop(&mut self) {
        self.close();
    }
}

fn checked_output(output: Output, name: &str) -> Result<String> {
    if !output.status.success() {
        let stderr = String::from_utf8_lossy(&output.stderr);
        bail!(
            "remote command on '{name}' failed with {}: {}",
            output.status,
            stderr.trim()
        );
    }
    Ok(String::from_utf8(output.stdout)?)
}

fn resolve_local_path(base: &Path, path: Option<&Path>) -> Result<Option<PathBuf>> {
    path.map(|path| {
        let path = crate::file::replace_path(path);
        let path = if path.is_absolute() {
            path
        } else {
            base.join(path)
        };
        absolutize(&path)
    })

View on GitHub (pinned to 6f52dcdf99)

Solutions

  1. Read the two placeholders: the exit status (e.g. 'exit status: 127' = command not found, 126 = not executable, 255 = ssh connection failure) and the remote stderr, which names the failing command
  2. Reproduce manually: ssh <user@host> sh -lc 'command -v mise' and ssh <user@host> 'mktemp -d /tmp/mise-bootstrap.XXXXXX' to see which probe fails
  3. If mise is missing or unusable on the remote, set exactly one of mise_bin, remote_mise, or bootstrap_command under [remote.<name>] in mise.toml so mise does not upload/run the local binary
  4. If the exit status is 255, fix SSH connectivity/credentials first (ssh-agent, IdentityFile, port) before retrying bootstrap
  5. Ensure /tmp on the remote is writable and not mounted noexec if the failure is in staging or the uploaded-binary version check

Example fix

# before: [remote.prod] host = "build.example.com" # remote has no mise, local binary is macOS, remote is linux
# after:
[remote.prod]
host = "build.example.com"
remote_mise = "mise" # resolve an x86_64-linux mise on the remote's login PATH instead of uploading the local binary
Defensive patterns

Strategy: retry

Validate before calling

dest="deploy@build.example.com"
ssh -o BatchMode=yes -o ConnectTimeout=10 "$dest" true \
  && ssh "$dest" sh -lc 'command -v mise' >/dev/null \
  && ssh "$dest" 'mktemp -d /tmp/mise-bootstrap.XXXXXX' >/dev/null \
  && echo "remote probes OK" || echo "remote probes failed: $?."

Try / catch

When scripting around mise bootstrap remote, capture the exit code and distinguish ssh transport failures (255, often transient) from remote command failures (127/126, config problems): retry only the former after fixing network/auth, and print the stderr embedded in the mise error before retrying.

Prevention

When it happens

Trigger: Any SshSession::output() command failing: staging creation script (mktemp under /tmp) fails because /tmp is not writable; 'sh -lc' probes fail with 127 because mise is not on the remote login PATH; the uploaded mise binary cannot execute (wrong arch/libc) during the 'version' check; 'rm -rf' cleanup of the staging dir fails; ssh itself fails to connect/authenticate and ssh exits non-zero.

Common situations: Running 'mise bootstrap remote' against a fresh or minimal remote host (no mise installed, restricted PATH from a non-login shell), macOS-to-Linux or x86-to-ARM binary incompatibility when mise_bin/remote_mise/bootstrap_command are not set, expired SSH keys or unreachable hosts, and read-only /tmp on hardened remotes.

Related errors


AI-assisted analysis of jdx/mise@6f52dcdf99 (2026-08-22). Data as JSON: /api/errors/e570df7771405e16. Report an issue: GitHub.