{"record":{"id":"4de44c90bc3b55db","repo":"jdx/mise","slug":"firewall-rule-name-name-must-contain-only-asci","errorCode":null,"errorMessage":"firewall rule name '{name}' must contain only ASCII letters, numbers, '-' or '_'","messagePattern":"firewall rule name '(.+?)' must contain only ASCII letters, numbers, '-' or '_'","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/firewall.rs","lineNumber":1963,"sourceCode":"fn command_error(program: &str, args: &[&str], output: &Output) -> eyre::Report {\n    eyre!(\n        \"{} failed with {}: {}\",\n        shell_words::join(\n            std::iter::once(program.to_string()).chain(args.iter().map(|arg| (*arg).to_string()))\n        ),\n        output.status,\n        String::from_utf8_lossy(&output.stderr).trim()\n    )\n}\n\nfn validate_name(name: &str) -> Result<()> {\n    if name.is_empty()\n        || name.len() > 64\n        || !name\n            .bytes()\n            .all(|byte| byte.is_ascii_alphanumeric() || matches!(byte, b'-' | b'_'))\n    {\n        bail!(\"firewall rule name '{name}' must contain only ASCII letters, numbers, '-' or '_'\");\n    }\n    Ok(())\n}\n\nfn validate_interface(interface: &str) -> Result<String> {\n    if interface.is_empty()\n        || interface.len() > 15\n        || !interface\n            .bytes()\n            .all(|byte| byte.is_ascii_alphanumeric() || matches!(byte, b'-' | b'_' | b'.' | b':'))\n    {\n        bail!(\"firewall interface '{interface}' is invalid\");\n    }\n    Ok(interface.to_string())\n}\n\nfn parse_ssh_connection(value: &str) -> Result<SshConnection> {\n    let fields = value.split_ascii_whitespace().collect::<Vec<_>>();","sourceCodeStart":1945,"sourceCodeEnd":1981,"githubUrl":"https://github.com/jdx/mise/blob/9dcfcaa0dc8747a2577d3270b69bb9d8313b2807/src/system/firewall.rs#L1945-L1981","documentation":"Thrown by validate_name (src/system/firewall.rs) when building a Linux firewall request from [bootstrap.linux.firewall] config. Rule names become stable identifiers for the generated iptables/nftables rules, so they must be 1-64 bytes of ASCII letters, digits, '-' or '_' only. Empty names, names over 64 bytes, or any other byte (space, dot, slash, UTF-8) fail fast at config parse time instead of producing unusable firewall rules.","triggerScenarios":"Declaring a firewall rule whose name contains a character outside [A-Za-z0-9_-] — e.g. a key like \"allow ssh (22)\", \"web/http\", \"règle-1\" — or a name longer than 64 bytes, or an empty name. Fires while parsing [bootstrap.linux.firewall] during mise bootstrap.","commonSituations":"Copying rule names from pf/ufw/firewalld configs that permit spaces, dots, or slashes; using FQDNs or free-text descriptions as rule names; localized non-ASCII names; long descriptive names generated by templating.","solutions":["Rename the rule to contain only ASCII letters, digits, '-' and '_' (e.g. allow_ssh_22)","Shorten the name to 64 bytes or fewer","Re-run mise bootstrap (or the firewall plan step) to confirm the config parses"],"exampleFix":"# before (mise.toml)\n# rule name contains spaces/parens -> rejected\n\"allow ssh (22)\" = { port = 22 }\n\n# after\nallow_ssh_22 = { port = 22 }","handlingStrategy":"validation","validationCode":"# before running mise bootstrap, check every rule name\nmise config ls 2>/dev/null; grep -oE '\"?[^\"=]+\"?\\s*=' mise.toml | tr -d ' \"=' | while read -r n; do\n  echo \"$n\" | grep -qE '^[A-Za-z0-9_-]{1,64}$' || echo \"invalid firewall rule name: $n\"\ndone","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use a naming convention of only lowercase letters, digits and hyphens for firewall rule names","Lint mise.toml in CI with a regex check for rule keys: ^[A-Za-z0-9_-]{1,64}$","Never paste free-text descriptions into rule name keys"],"tags":["mise","firewall","bootstrap","linux","config-validation"],"backgroundTag":"config-validation-failed","analyzedSha":"9dcfcaa0dc8747a2577d3270b69bb9d8313b2807","analyzedAt":"2026-08-17T14:28:50.624Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}