{"record":{"id":"e570df7771405e16","repo":"jdx/mise","slug":"remote-command-on-name-failed-with","errorCode":null,"errorMessage":"remote command on '{name}' failed with {}: {}","messagePattern":"remote command on '(.+?)' failed with (.+?): (.+?)","errorType":"exception","errorClass":"eyre::Report","httpStatus":null,"severity":"error","filePath":"src/system/remote.rs","lineNumber":1590,"sourceCode":"        if status.is_ok_and(|status| !status.success()) {\n            debug!(\n                \"SSH control connection for {} was already closed\",\n                self.host.name\n            );\n        }\n    }\n}\n\nimpl Drop for SshSession<'_> {\n    fn drop(&mut self) {\n        self.close();\n    }\n}\n\nfn checked_output(output: Output, name: &str) -> Result<String> {\n    if !output.status.success() {\n        let stderr = String::from_utf8_lossy(&output.stderr);\n        bail!(\n            \"remote command on '{name}' failed with {}: {}\",\n            output.status,\n            stderr.trim()\n        );\n    }\n    Ok(String::from_utf8(output.stdout)?)\n}\n\nfn resolve_local_path(base: &Path, path: Option<&Path>) -> Result<Option<PathBuf>> {\n    path.map(|path| {\n        let path = crate::file::replace_path(path);\n        let path = if path.is_absolute() {\n            path\n        } else {\n            base.join(path)\n        };\n        absolutize(&path)\n    })","sourceCodeStart":1572,"sourceCodeEnd":1608,"githubUrl":"https://github.com/jdx/mise/blob/6f52dcdf99e282ef7a7db68c81301fa4618d0f79/src/system/remote.rs#L1572-L1608","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["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","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","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","If the exit status is 255, fix SSH connectivity/credentials first (ssh-agent, IdentityFile, port) before retrying bootstrap","Ensure /tmp on the remote is writable and not mounted noexec if the failure is in staging or the uploaded-binary version check"],"exampleFix":"# before: [remote.prod] host = \"build.example.com\" # remote has no mise, local binary is macOS, remote is linux\n# after:\n[remote.prod]\nhost = \"build.example.com\"\nremote_mise = \"mise\" # resolve an x86_64-linux mise on the remote's login PATH instead of uploading the local binary","handlingStrategy":"retry","validationCode":"dest=\"deploy@build.example.com\"\nssh -o BatchMode=yes -o ConnectTimeout=10 \"$dest\" true \\\n  && ssh \"$dest\" sh -lc 'command -v mise' >/dev/null \\\n  && ssh \"$dest\" 'mktemp -d /tmp/mise-bootstrap.XXXXXX' >/dev/null \\\n  && echo \"remote probes OK\" || echo \"remote probes failed: $?.\"","typeGuard":null,"tryCatchPattern":"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.","preventionTips":["Pre-flight the remote with ssh <dest> true and ssh <dest> sh -lc 'command -v mise'","Set one of mise_bin/remote_mise/bootstrap_command for remotes whose platform differs from the local machine","Keep the remote login shell quiet (no echo in .zshenv/.profile) so probe output stays parseable","Use BatchMode/ControlMaster in ssh_options to fail fast instead of hanging on auth prompts"],"tags":["ssh","remote-bootstrap","exit-code","mise"],"backgroundTag":"ssh-command-failed","analyzedSha":"6f52dcdf99e282ef7a7db68c81301fa4618d0f79","analyzedAt":"2026-08-22T10:14:23.840Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}