jdx/mise · error

firewall port ' ' must be a number or inclusive range

Error message

firewall port '{range}' must be a number or inclusive range

What it means

`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.

Solutions

  1. Use `start-end` (e.g. `"8080-8090"`) or `start:end` for ranges
  2. Use a plain number for a single port instead of a range string
  3. Validate the config with `mise doctor` or the config schema before applying

Example fix

// before (mise.toml)
[[firewall.rules]]
ports = ["8080..8090"]

// after
[[firewall.rules]]
ports = ["8080-8090"]
Defensive patterns

Strategy: validation

Validate before calling

function validPort(p) {
  return /^[0-9]+$/.test(p) || /^(\d+)([-:])(\d+)$/.test(p);
}

Prevention

When it happens

Trigger: 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`).

Common situations: 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.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


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

Appendix: source

Thrown at src/system/firewall.rs:199

#[serde(untagged)]
pub(crate) enum FirewallPortToml {
    Single(u16),
    Range(String),
}

#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize)]
pub(crate) struct FirewallPort {
    start: u16,
    end: u16,
}

impl FirewallPort {
    fn from_toml(value: FirewallPortToml) -> Result<Self> {
        let (start, end) = match value {
            FirewallPortToml::Single(port) => (port, port),
            FirewallPortToml::Range(range) => {
                let Some((start, end)) = range.split_once(['-', ':']) else {
                    bail!("firewall port '{range}' must be a number or inclusive range")
                };
                (start.parse()?, end.parse()?)
            }
        };
        if start == 0 || end == 0 || start > end {
            bail!("firewall port range {start}-{end} is invalid");
        }
        Ok(Self { start, end })
    }

    fn contains(self, port: u16) -> bool {
        self.start <= port && port <= self.end
    }

    fn render(self, separator: char) -> String {
        if self.start == self.end {
            self.start.to_string()
        } else {

View on GitHub (pinned to 533346cc37)