{"record":{"id":"180d90e08738c53d","repo":"jdx/mise","slug":"kind-returned-an-unsafe-absolute-path-path","errorCode":null,"errorMessage":"{kind} returned an unsafe absolute path: {path:?}","messagePattern":"(.+?) returned an unsafe absolute path: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/remote.rs","lineNumber":1659,"sourceCode":"    }\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)?;\n    let is_path = command.contains('/');\n    if command.starts_with('-')\n        || command.contains(['\\n', '\\r'])\n        || (!is_path && command.chars().any(char::is_whitespace))\n    {\n        bail!(\"remote mise command must be an executable name or path: {command:?}\");\n    }\n    Ok(())\n}\n\nfn shell_quote(value: &str) -> String {\n    shell_words::join([value])","sourceCodeStart":1641,"sourceCodeEnd":1677,"githubUrl":"https://github.com/jdx/mise/blob/6f52dcdf99e282ef7a7db68c81301fa4618d0f79/src/system/remote.rs#L1641-L1677","documentation":"mise runs remote probes whose stdout must be a single absolute path — 'remote login executable' is the output of 'command -v <name>' when remote_mise is a bare name, and 'remote login home' is the remote $HOME used to expand '~/...' remote_mise paths. validated_absolute_remote_path_output rejects output that does not start with '/' or contains NUL/newline/CR before it is used to build commands.","triggerScenarios":"resolve_login_path_executable() with remote_mise = \"mise\": the script exits 127 with empty stdout when mise is not on the remote login PATH, yielding '' which fails the '/' check; resolve_configured_remote_mise() with remote_mise = \"~/bin/mise\" when $HOME is unset/relative or the printf output carries a CR or extra lines from profile noise.","commonSituations":"remote_mise set to a bare name on a host where mise was installed via a non-login method (not in .profile PATH), remotes where HOME is not set for the ssh forced-command environment, banner-printing login shells appending lines, and CRLF-emitting shells.","solutions":["Check the {kind} placeholder: 'remote login executable' means command -v failed; 'remote login home' means $HOME resolution failed","For the executable case run ssh <dest> sh -lc 'command -v mise' — if empty, install mise on the remote or reference it by absolute path: remote_mise = \"/usr/local/bin/mise\"","For the home case verify ssh <dest> sh -lc 'printf %s\\\\n \"$HOME\"' prints one absolute path; fix HOME in the remote login environment if not","Silence any login-shell banner output that appends extra lines to these probes"],"exampleFix":"# before: [remote.prod] host = \"build.example.com\" remote_mise = \"mise\" # not on remote login PATH\n# after:\n[remote.prod]\nhost = \"build.example.com\"\nremote_mise = \"~/.local/bin/mise\" # expanded against the remote $HOME, or use an absolute path","handlingStrategy":"validation","validationCode":"ssh \"$dest\" sh -lc 'command -v mise' | head -1 | grep -q '^/' && echo ok || echo \"remote login executable not absolute\"\nssh \"$dest\" sh -lc 'printf \"%s\\n\" \"$HOME\"' | head -1 | grep -q '^/' && echo ok || echo \"remote HOME not absolute\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Install mise on the remote via a login-shell-visible path (e.g. /usr/local/bin) or reference it absolutely","Verify HOME is set correctly for ssh non-interactive sessions on the remote","Avoid bare-name remote_mise on hosts whose profiles print extra output"],"tags":["ssh","remote-bootstrap","path-validation","command-not-found","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"}