jdx/mise · error
invalid remote
Error message
invalid remote {kind}: {value} What it means
`validate_ssh_atom` validates individual remote command components (host, user, remote paths, args — the `kind` names which) and rejects values that start with '-' (which SSH would parse as a flag) or contain whitespace (which would split an argument). This is an injection/argument-confusion guard before values are passed to the ssh command line.
Solutions
- Remove leading dashes and whitespace from the configured host/user/path value
- Quote or escape spaces in filesystem paths at the source of configuration, or use the path as a single atom without spaces
- If ssh needs extra flags (e.g. port), use the dedicated option field/args rather than embedding them in the host atom
Example fix
// before MISE_REMOTE_HOST="deploy@host -p 2222" # starts atom with flag injection // after MISE_REMOTE_HOST="deploy@host" MISE_REMOTE_PORT=2222 # pass options as their own fields
Defensive patterns
Strategy: validation
Validate before calling
fn is_safe_ssh_atom(v: &str) -> bool {
!v.is_empty() && !v.starts_with('-') && !v.chars().any(char::is_whitespace) && !v.contains('\\0')
}
// before invoking:
assert!(is_safe_ssh_atom(host), "host must not start with '-' or contain spaces"); Type guard
fn valid_remote_host(v: &str) -> Option<&str> {
(!v.starts_with('-') && !v.contains(char::is_whitespace)).then_some(v)
} Try / catch
match Err(e) if e.to_string().starts_with("invalid remote ") {
// fix the offending config value named in `kind` and retry
fix_remote_config(&kind); retry();
} Prevention
- Never embed ssh flags (ports, options) inside host/user values
- Quote paths with spaces at config time or avoid spaces entirely
- Keep one value per config field; no shell-style bundling
When it happens
Trigger: Configuring a remote target with a host, user, or path that begins with '-' or contains spaces — e.g. host name with a space, a path with unquoted spaces, or a malicious-looking '-oProxyCommand=...' value.
Common situations: Typo in remote config where the value absorbed a separator (e.g. `host -p 2222` pasted as one string); paths containing spaces on the remote; attempted option injection into ssh.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- remote host ' ' port must be greater than zero
- remote cannot be empty or contain NUL
- remote mktemp returned an unsafe staging path
- a repository preview directory requires a dry run
- bootstrap_command returned an unsafe mise path
AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17).
Data as JSON: /api/errors/a6a59fc7a7b2bacc.
Report an issue: GitHub.
Appendix: source
Thrown at src/system/remote.rs:2172
base.join(path)
};
absolutize(&path)
})
.transpose()
}
fn absolutize(path: &Path) -> Result<PathBuf> {
if path.is_absolute() {
Ok(path.to_path_buf())
} else {
Ok(std::env::current_dir()?.join(path))
}
}
fn validate_ssh_atom(kind: &str, value: &str) -> Result<()> {
validate_value(kind, value)?;
if value.starts_with('-') || value.chars().any(char::is_whitespace) {
bail!("invalid remote {kind}: {value}");
}
Ok(())
}
fn validate_value(kind: &str, value: &str) -> Result<()> {
if value.is_empty() || value.contains('\0') {
bail!("remote {kind} cannot be empty or contain NUL");
}
Ok(())
}
fn validate_staging_path(path: &str) -> Result<()> {
if !path.starts_with("/tmp/mise-bootstrap.")
|| path["/tmp/mise-bootstrap.".len()..].is_empty()
|| path.chars().any(char::is_whitespace)
{
bail!("remote mktemp returned an unsafe staging path: {path:?}");
}View on GitHub (pinned to 533346cc37)