jdx/mise · error

install_mise must not contain a newline: {path:?}

Error message

install_mise must not contain a newline: {path:?}

What it means

When configuring where mise should be installed on a remote host (the install_mise setting), mise validates the configured path. Because this path is interpolated into remote shell commands, embedded CR/LF characters would allow command injection, so any newline in the value is rejected with this error.

Source

Thrown at src/system/remote.rs:2214

    Ok(command.to_string())
}

fn validated_remote_command_output(output: &str) -> Result<String> {
    validated_remote_command(output.strip_suffix('\n').unwrap_or(output))
}

fn validated_absolute_remote_path_output(output: &str, kind: &str) -> Result<String> {
    let path = output.strip_suffix('\n').unwrap_or(output);
    if !path.starts_with('/') || path.contains(['\0', '\n', '\r']) {
        bail!("{kind} returned an unsafe absolute path: {path:?}");
    }
    Ok(path.to_string())
}

fn validate_install_mise_path(path: &str) -> Result<()> {
    validate_value("mise install path", path)?;
    if path.contains(['\n', '\r']) {
        bail!("install_mise must not contain a newline: {path:?}");
    }
    if !path.starts_with('/') && !path.starts_with("~/") {
        bail!("install_mise must be an absolute path or start with ~/: {path:?}");
    }
    if path.split('/').any(|component| component == "..") {
        bail!("install_mise must not contain '..': {path:?}");
    }
    if matches!(
        path.rsplit('/').next(),
        None | Some("") | Some(".") | Some("~")
    ) {
        bail!("install_mise must name an executable file: {path:?}");
    }
    Ok(())
}

fn validate_remote_executable(command: &str) -> Result<()> {
    validate_value("mise command", command)?;

View on GitHub (pinned to afd2eddd3a)

Solutions

  1. Remove the line break from the install_mise path value in your config
  2. Trim whitespace/newlines when loading the value programmatically before passing it to mise
  3. Use single-line quoting in TOML/YAML (e.g. path = "/usr/local/bin/mise")

Example fix

// before
install_mise = """
/usr/local/bin/mise
"""
// after
install_mise = "/usr/local/bin/mise"
Defensive patterns

Strategy: validation

Validate before calling

const validateInstallMisePath = (p) => { if (/[\n\r]/.test(p)) throw new Error('newline in install_mise path'); return p; };

Type guard

const hasNoNewlines = (s) => typeof s === 'string' && !/[\n\r]/.test(s);

Try / catch

try { setInstallMisePath(cfg.install_mise); } catch (e) { console.error('Fix install_mise value (no newlines allowed)'); process.exit(1); }

Prevention

When it happens

Trigger: The install_mise path (config value or remote onboarding option) contains a literal '\n' or '\r' character — typically from a multi-line config value, a pasted string with hidden line breaks, or reading the value from a file without trimming.

Common situations: YAML/TOML config where the value accidentally spans lines; shell history or editor pastes carrying trailing CR; scripts that append "$(cat file)" where the file has a trailing newline.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


AI-assisted analysis of jdx/mise@afd2eddd3a (2026-09-09). Data as JSON: /api/errors/fdd03baf2a61f590. Report an issue: GitHub.