{"record":{"id":"1e98b1d5261fd35c","repo":"jdx/mise","slug":"connect-timeout-must-be-greater-than-zero","errorCode":null,"errorMessage":"--connect-timeout must be greater than zero","messagePattern":"--connect-timeout must be greater than zero","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cli/bootstrap.rs","lineNumber":2321,"sourceCode":"        if self.missing && missing {\n            return Err(crate::request_exit(1));\n        }\n        Ok(())\n    }\n}\n\nimpl BootstrapSecrets {\n    async fn run(self) -> Result<()> {\n        match self.command {\n            BootstrapSecretsCommands::Status(command) => command.run().await,\n        }\n    }\n}\n\nimpl BootstrapRemote {\n    async fn run(self) -> Result<()> {\n        if self.connect_timeout == 0 {\n            bail!(\"--connect-timeout must be greater than zero\");\n        }\n        let config = Config::get().await?;\n        let config_excludes = system::remote::excludes_from_config(&config);\n        let inventory = system::remote::hosts_from_config(&config, &config_excludes)?;\n        let mut selected = select_remote_inventory(&inventory, &self.targets, self.all, &self.tag)?;\n        let ad_hoc_source = self.source.clone().unwrap_or(std::env::current_dir()?);\n        for destination in &self.host {\n            let host =\n                system::remote::ad_hoc_host(destination, ad_hoc_source.clone(), &config_excludes)?;\n            if selected.insert(host.name.clone(), host).is_some() {\n                bail!(\"remote target '{destination}' was selected more than once\");\n            }\n        }\n        if selected.is_empty() {\n            if inventory.is_empty() {\n                bail!(\n                    \"no remote targets configured; pass --host [user@]host or add [bootstrap.remote.hosts]\"\n                );","sourceCodeStart":2303,"sourceCodeEnd":2339,"githubUrl":"https://github.com/jdx/mise/blob/9dcfcaa0dc8747a2577d3270b69bb9d8313b2807/src/cli/bootstrap.rs#L2303-L2339","documentation":"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.","triggerScenarios":"'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.","commonSituations":"CI templates with CONNECT_TIMEOUT=0 intended to mean 'wait forever'; misconfigured pipeline variables; copy-pasted flags from tools where 0 means 'use default'.","solutions":["Pass a positive number: --connect-timeout 10","Omit the flag to use the built-in default timeout","In scripts, default safely: TIMEOUT=${TIMEOUT:-10}","For 'effectively unlimited' use a large value such as 600, not 0"],"exampleFix":"# before\nmise bootstrap remote --host deploy@web1 --connect-timeout 0\n# Error: --connect-timeout must be greater than zero\n\n# after\nmise bootstrap remote --host deploy@web1 --connect-timeout 10","handlingStrategy":"validation","validationCode":"# bash: guard the flag value before invoking mise\n[ \"${CONNECT_TIMEOUT:-10}\" -gt 0 ] 2>/dev/null || CONNECT_TIMEOUT=10\nmise bootstrap remote --connect-timeout \"$CONNECT_TIMEOUT\" \"$@\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Default timeout variables with :-10, never :-0","In wrappers, treat 0 as 'unset' and substitute the default"],"tags":["mise","bootstrap","remote","ssh","cli-args","validation"],"backgroundTag":"invalid-cli-argument","analyzedSha":"9dcfcaa0dc8747a2577d3270b69bb9d8313b2807","analyzedAt":"2026-08-17T14:28:50.624Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}