jdx/mise · error

remote host ' ' port must be greater than zero

Error message

remote host '{}' port must be greater than zero

What it means

Remote host configuration validation rejects a port explicitly set to 0 for a remote target, since a zero port is meaningless for SSH/rsync. validate_with_source checks this for every remote host config during apply_overrides/validate.

Solutions

  1. Remove the `port` key to use the SSH default (22).
  2. Set the port to the actual listening port of the remote SSH server.
  3. Check the config generator/template so it omits the key instead of emitting 0.

Example fix

// before
[[remote_host]]
name = "build-box"
port = 0
// after
[[remote_host]]
name = "build-box"
port = 2222
Defensive patterns

Strategy: validation

Validate before calling

function validateRemoteHost(host) {
  if (host.port !== undefined && (Number(host.port) <= 0 || !Number.isInteger(host.port))) {
    throw new Error(`remote host '${host.name}' port must be greater than zero`);
  }
}

Prevention

When it happens

Trigger: A remote host entry in configuration has `port = 0` (or is programmatically constructed with Some(0)); validate() or apply_overrides() then calls validate_with_source and bails.

Common situations: Copy-pasting config templates with placeholder 0 values; a templating/config generator that emits 0 when the real port is missing; editing TOML and typing 0 instead of deleting the key to use the SSH default (22).

Understand the failure class

Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.

Related errors


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

Appendix: source

Thrown at src/system/remote.rs:326

    pub(crate) fn destination(&self) -> String {
        match &self.user {
            Some(user) => format!("{user}@{}", self.host),
            None => self.host.clone(),
        }
    }

    fn validate(&self) -> Result<()> {
        self.validate_with_source(true)
    }

    fn validate_with_source(&self, archive: bool) -> Result<()> {
        validate_ssh_atom("host", &self.host)?;
        if let Some(user) = &self.user {
            validate_ssh_atom("user", user)?;
        }
        if self.port == Some(0) {
            bail!("remote host '{}' port must be greater than zero", self.name);
        }
        if archive && !self.source.is_dir() {
            bail!(
                "remote host '{}' source is not a directory: {}",
                self.name,
                self.source.display()
            );
        }
        if archive && !self.copy_links {
            for link in &self.copy_link {
                validate_copy_link(&self.source, link).wrap_err_with(|| {
                    format!("remote host '{}' has invalid copy_link", self.name)
                })?;
            }
        }
        if let Some(identity) = &self.identity_file
            && !identity.is_file()
        {

View on GitHub (pinned to 533346cc37)