{"record":{"id":"befd664e7e1095aa","repo":"jdx/mise","slug":"bootstrap-command-returned-an-unsafe-mise-path-c","errorCode":null,"errorMessage":"bootstrap_command returned an unsafe mise path: {command:?}","messagePattern":"bootstrap_command returned an unsafe mise path: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/remote.rs","lineNumber":1647,"sourceCode":"    if value.is_empty() || value.contains('\\0') {\n        bail!(\"remote {kind} cannot be empty or contain NUL\");\n    }\n    Ok(())\n}\n\nfn validate_staging_path(path: &str) -> Result<()> {\n    if !path.starts_with(\"/tmp/mise-bootstrap.\")\n        || path[\"/tmp/mise-bootstrap.\".len()..].is_empty()\n        || path.chars().any(char::is_whitespace)\n    {\n        bail!(\"remote mktemp returned an unsafe staging path: {path:?}\");\n    }\n    Ok(())\n}\n\nfn validated_remote_command(command: &str) -> Result<String> {\n    if !command.starts_with('/') || command.contains(['\\0', '\\n', '\\r']) {\n        bail!(\"bootstrap_command returned an unsafe mise path: {command:?}\");\n    }\n    Ok(command.to_string())\n}\n\nfn validated_remote_command_output(output: &str) -> Result<String> {\n    validated_remote_command(output.strip_suffix('\\n').unwrap_or(output))\n}\n\nfn validated_absolute_remote_path_output(output: &str, kind: &str) -> Result<String> {\n    let path = output.strip_suffix('\\n').unwrap_or(output);\n    if !path.starts_with('/') || path.contains(['\\0', '\\n', '\\r']) {\n        bail!(\"{kind} returned an unsafe absolute path: {path:?}\");\n    }\n    Ok(path.to_string())\n}\n\nfn validate_remote_executable(command: &str) -> Result<()> {\n    validate_value(\"mise command\", command)?;","sourceCodeStart":1629,"sourceCodeEnd":1665,"githubUrl":"https://github.com/jdx/mise/blob/6f52dcdf99e282ef7a7db68c81301fa4618d0f79/src/system/remote.rs#L1629-L1665","documentation":"When no provisioning strategy is configured, mise discovers mise on the remote by running a login-shell script and requires the result to be an absolute path (starting with '/') free of NUL, newline, and carriage return. validated_remote_command rejects the discovered path when that contract breaks, because it is later executed verbatim on the remote.","triggerScenarios":"resolve_remote_mise() running 'sh -lc <remote_mise_output_script>' when mise_bin/remote_mise/bootstrap_command are all unset: the resolved mise path comes back relative (odd shim or function printing a relative path), or stdout contains extra lines or CRLF because the remote profile prints banners or a Windows-style line ending is emitted.","commonSituations":"Remote hosts whose login shell prints MOTD/banner text before the path, mise installed via a shell function or alias that echoes something other than an absolute path, .profile lines like 'echo $SHELL', and remotes where /usr/local/bin/mise is a relative symlink resolved oddly.","solutions":["Check what the probe actually returns: ssh <dest> sh -lc 'command -v mise' — you should see exactly one absolute path line","Remove or silence startup output in the remote login shell (.profile/.bash_profile/.zprofile MOTD echoes) so the only stdout is the path","If discovery cannot be made clean, bypass it by setting remote_mise = \"/usr/local/bin/mise\" (or mise_bin/bootstrap_command) under [remote.<name>]","If the printed path is relative, reinstall mise on the remote so 'command -v mise' resolves to an absolute path"],"exampleFix":"# before: [remote.prod] host = \"build.example.com\" # discovery polluted by remote profile output\n# after:\n[remote.prod]\nhost = \"build.example.com\"\nremote_mise = \"/usr/local/bin/mise\"","handlingStrategy":"validation","validationCode":"path=$(ssh \"$dest\" sh -lc 'command -v mise')\ncase \"$path\" in /*) [ \"$(printf '%s' \"$path\" | wc -l) -eq 1 ] || echo \"multi-line output, profile noise\" >&2;; *) echo \"mise not resolvable to absolute path on remote\" >&2;; esac","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pin remote_mise to an absolute path on hosts with chatty login shells","Ensure remote mise is a real executable on PATH, not a shell function printing non-path text","Suppress MOTD/banner echoes in remote profiles used by automation"],"tags":["ssh","remote-bootstrap","path-validation","output-validation","mise"],"backgroundTag":"remote-shell-output-pollution","analyzedSha":"6f52dcdf99e282ef7a7db68c81301fa4618d0f79","analyzedAt":"2026-08-22T10:14:23.840Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}