{"record":{"id":"47b531058e29276a","repo":"jdx/mise","slug":"firewall-port-range-must-be-a-number-or-inclus","errorCode":null,"errorMessage":"firewall port '{range}' must be a number or inclusive range","messagePattern":"firewall port '(.+?)' must be a number or inclusive range","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/firewall.rs","lineNumber":199,"sourceCode":"#[serde(untagged)]\npub(crate) enum FirewallPortToml {\n    Single(u16),\n    Range(String),\n}\n\n#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize)]\npub(crate) struct FirewallPort {\n    start: u16,\n    end: u16,\n}\n\nimpl FirewallPort {\n    fn from_toml(value: FirewallPortToml) -> Result<Self> {\n        let (start, end) = match value {\n            FirewallPortToml::Single(port) => (port, port),\n            FirewallPortToml::Range(range) => {\n                let Some((start, end)) = range.split_once(['-', ':']) else {\n                    bail!(\"firewall port '{range}' must be a number or inclusive range\")\n                };\n                (start.parse()?, end.parse()?)\n            }\n        };\n        if start == 0 || end == 0 || start > end {\n            bail!(\"firewall port range {start}-{end} is invalid\");\n        }\n        Ok(Self { start, end })\n    }\n\n    fn contains(self, port: u16) -> bool {\n        self.start <= port && port <= self.end\n    }\n\n    fn render(self, separator: char) -> String {\n        if self.start == self.end {\n            self.start.to_string()\n        } else {","sourceCodeStart":181,"sourceCodeEnd":217,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/firewall.rs#L181-L217","documentation":"`FirewallPort::from_toml` parses a firewall rule port spec. A range string must contain a `-` or `:` separator; a `Range` TOML value without one is neither a number nor a valid inclusive range, so the parser bails with this message echoing the offending string.","triggerScenarios":"Declaring a firewall port in mise.toml as a range value lacking any `-` or `:` separator, e.g. `ports = [\"8080\"]` where the value is typed as a range (or a non-numeric separator like `8080 to 9090`).","commonSituations":"Typos in config: writing `\"80 443\"`, `\"80/443\"`, or `\"8080..8090\"` instead of `\"8080-8090\"`; forgetting that single ports must be plain numbers, not strings parsed as ranges.","solutions":["Use `start-end` (e.g. `\"8080-8090\"`) or `start:end` for ranges","Use a plain number for a single port instead of a range string","Validate the config with `mise doctor` or the config schema before applying"],"exampleFix":"// before (mise.toml)\n[[firewall.rules]]\nports = [\"8080..8090\"]\n\n// after\n[[firewall.rules]]\nports = [\"8080-8090\"]","handlingStrategy":"validation","validationCode":"function validPort(p) {\n  return /^[0-9]+$/.test(p) || /^(\\d+)([-:])(\\d+)$/.test(p);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always separate range endpoints with `-` or `:`","Write single ports as plain numbers","Validate mise.toml against the schema after edits"],"tags":["firewall","config","port","format"],"backgroundTag":"invalid-argument-format","analyzedSha":"533346cc374382b41ec5ff70536252b2e96e725c","analyzedAt":"2026-09-17T13:35:38.149Z","contentChangedAt":"2026-09-17T13:35:38.149Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}