jdx/mise · error

--connect-timeout must be greater than zero

Error message

--connect-timeout must be greater than zero

What it means

BootstrapRemote::run (src/cli/bootstrap.rs:2321) validates --connect-timeout before doing anything else: the SSH connect timeout in seconds must be strictly positive. Zero would make every connection attempt fail immediately, so mise fails fast with a usage error instead of contacting any host.

Source

Thrown at src/cli/bootstrap.rs:2321

        if self.missing && missing {
            return Err(crate::request_exit(1));
        }
        Ok(())
    }
}

impl BootstrapSecrets {
    async fn run(self) -> Result<()> {
        match self.command {
            BootstrapSecretsCommands::Status(command) => command.run().await,
        }
    }
}

impl BootstrapRemote {
    async fn run(self) -> Result<()> {
        if self.connect_timeout == 0 {
            bail!("--connect-timeout must be greater than zero");
        }
        let config = Config::get().await?;
        let config_excludes = system::remote::excludes_from_config(&config);
        let inventory = system::remote::hosts_from_config(&config, &config_excludes)?;
        let mut selected = select_remote_inventory(&inventory, &self.targets, self.all, &self.tag)?;
        let ad_hoc_source = self.source.clone().unwrap_or(std::env::current_dir()?);
        for destination in &self.host {
            let host =
                system::remote::ad_hoc_host(destination, ad_hoc_source.clone(), &config_excludes)?;
            if selected.insert(host.name.clone(), host).is_some() {
                bail!("remote target '{destination}' was selected more than once");
            }
        }
        if selected.is_empty() {
            if inventory.is_empty() {
                bail!(
                    "no remote targets configured; pass --host [user@]host or add [bootstrap.remote.hosts]"
                );

View on GitHub (pinned to 9dcfcaa0dc)

Solutions

  1. Pass a positive number: --connect-timeout 10
  2. Omit the flag to use the built-in default timeout
  3. In scripts, default safely: TIMEOUT=${TIMEOUT:-10}
  4. For 'effectively unlimited' use a large value such as 600, not 0

Example fix

# before
mise bootstrap remote --host deploy@web1 --connect-timeout 0
# Error: --connect-timeout must be greater than zero

# after
mise bootstrap remote --host deploy@web1 --connect-timeout 10
Defensive patterns

Strategy: validation

Validate before calling

# bash: guard the flag value before invoking mise
[ "${CONNECT_TIMEOUT:-10}" -gt 0 ] 2>/dev/null || CONNECT_TIMEOUT=10
mise bootstrap remote --connect-timeout "$CONNECT_TIMEOUT" "$@"

Prevention

When it happens

Trigger: 'mise bootstrap remote --connect-timeout 0'; a wrapper script passing an unset variable that defaults to 0; arithmetic (e.g. $((x/10)) with small x) flooring to 0.

Common situations: CI templates with CONNECT_TIMEOUT=0 intended to mean 'wait forever'; misconfigured pipeline variables; copy-pasted flags from tools where 0 means 'use default'.

Understand the failure class

Related errors


AI-assisted analysis of jdx/mise@9dcfcaa0dc (2026-08-17). Data as JSON: /api/errors/1e98b1d5261fd35c. Report an issue: GitHub.