jdx/mise · error

firewall rule ' ' is declared more than once

Error message

firewall rule '{name}' is declared more than once

What it means

mise's firewall bootstrap configuration parses `[firewall]` TOML rules into a FirewallRequest, and rule names are used as stable identifiers for idempotent application and plan previews. Two rules sharing the same name would make ordering, dedup, and lockout analysis ambiguous, so from_toml rejects the second occurrence via a HashSet uniqueness check at parse time.

Solutions

  1. Find the duplicate `[[firewall.rules]]` entry with that name in your mise.toml and give one of them a unique name.
  2. If the rules are meant to be identical, delete the redundant one.
  3. If the rules intentionally differ, rename each to describe its purpose (e.g. 'allow-ssh-wan', 'allow-http-lan').

Example fix

// before (mise.toml)
[[firewall.rules]]
name = "allow-http"
port = 80
protocol = "tcp"
action = "allow"

[[firewall.rules]]
name = "allow-http"
port = 443
protocol = "tcp"
action = "allow"

// after
[[firewall.rules]]
name = "allow-http"
port = 80
protocol = "tcp"
action = "allow"

[[firewall.rules]]
name = "allow-https"
port = 443
protocol = "tcp"
action = "allow"
Defensive patterns

Strategy: validation

Validate before calling

let names: Vec<&str> = firewall_config.rules.iter().map(|r| r.name.as_str()).collect();
let dupes: Vec<&str> = names.iter().filter(|n| names.iter().filter(|m| m == n).count() > 1).map(|n| *n).collect();
if !dupes.is_empty() { return Err(format!("duplicate firewall rule names: {dupes:?}")); }

Type guard

fn has_unique_rule_names(rules: &[FirewallRuleToml]) -> bool {
    let mut seen = std::collections::HashSet::new();
    rules.iter().all(|r| seen.insert(&r.name))
}

Try / catch

match FirewallRequest::from_toml(cfg) {
    Err(e) if e.to_string().contains("declared more than once") => {
        eprintln!("fix duplicate [[firewall.rules]] names in mise.toml");
    }
    other => other?,
}

Prevention

When it happens

Trigger: Calling the firewall bootstrap path (e.g. `mise bootstrap firewall ...` or the internal __inspect-firewall-plan pipeline) with a mise.toml that defines two firewall rules whose `name` fields are identical. The check runs in FirewallRequest::from_toml right after validate_name.

Common situations: Copy-pasting a rule block to tweak one field (port, direction) but forgetting to rename it; merging config files from two machines that each defined the same rule name; generating config in a script that emits duplicate names.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


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

Appendix: source

Thrown at src/system/firewall.rs:401

            "--no-hooks".to_string(),
            "bootstrap".to_string(),
            "__inspect-firewall-plan".to_string(),
        ],
        &input,
    )?;
    request.inspection = Some(serde_json::from_slice(&output)?);
    Ok(())
}

impl FirewallRequest {
    fn from_toml(config: FirewallTomlConfig) -> Result<Self> {
        let mut rules = vec![];
        let mut names = HashSet::new();
        for rule in config.rules {
            let name = rule.name;
            validate_name(&name)?;
            if !names.insert(name.clone()) {
                bail!("firewall rule '{name}' is declared more than once");
            }
            let interface = rule
                .interface
                .map(|interface| validate_interface(interface.trim()))
                .transpose()?;
            let source = rule
                .source
                .map(|source| source.parse::<IpNet>())
                .transpose()
                .wrap_err_with(|| format!("firewall rule '{name}' has an invalid source"))?;
            let destination = rule
                .destination
                .map(|destination| destination.parse::<IpNet>())
                .transpose()
                .wrap_err_with(|| format!("firewall rule '{name}' has an invalid destination"))?;
            if source.is_some_and(|source| {
                destination.is_some_and(|destination| {
                    source.addr().is_ipv4() != destination.addr().is_ipv4()

View on GitHub (pinned to 533346cc37)