jdx/mise · error
firewall rule ' ' uses action = "limit", which requires…
Error message
firewall rule '{}' uses action = "limit", which requires direction = "incoming" and protocol = "tcp" What it means
Connection limiting (action = "limit") is only meaningful for inbound TCP traffic, so validation rejects any limit rule whose direction is not "incoming" or whose protocol is not "tcp". The library enforces this invariant before generating any backend-specific commands so invalid rules never reach nftables/ufw/firewalld.
Solutions
- Set direction = "incoming" and protocol = "tcp" on the limit rule.
- Change the action to "allow" or "deny" if per-connection limiting is not actually needed.
- Split the rule: keep the broad rule without limit and add a separate incoming/tcp limit rule.
- Wrap rule construction in a helper that asserts these invariants before building the request.
Example fix
// before
FirewallRule { name: "ssh-limit", action: FirewallAction::Limit, direction: FirewallDirection::Outgoing, protocol: None, .. }
// after
FirewallRule { name: "ssh-limit", action: FirewallAction::Limit, direction: FirewallDirection::Incoming, protocol: Some(FirewallProtocol::Tcp), .. } Defensive patterns
Strategy: validation
Validate before calling
fn is_valid_limit_rule(rule: &FirewallRule) -> bool {
rule.action != FirewallAction::Limit
|| (rule.direction == FirewallDirection::Incoming
&& rule.protocol == Some(FirewallProtocol::Tcp))
} Try / catch
if let Err(e) = apply(&request, false, true) {
if e.to_string().contains("action = \"limit\"") {
eprintln!("fix rule direction/protocol to incoming/tcp: {e}");
}
} Prevention
- Define limit rules only through a constructor that sets incoming/tcp defaults
- Lint rule sets for limit invariants before submit
- Never leave protocol unset on limit rules
- Review copy-pasted rule templates for direction/protocol
When it happens
Trigger: Defining a FirewallRule with action = FirewallAction::Limit while direction is Outgoing (or not Incoming) or protocol is None/Some(Udp)/Some(Sctp)/Some(Dccp), then submitting the FirewallRequest to apply/validate_backend_request.
Common situations: Copy-pasting a rate-limit rule template and forgetting to set protocol = "tcp"; intending an outbound rate limit; leaving protocol unset because the developer assumed a default.
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
- firewall interface ' ' is invalid
- firewall rule name ' ' must contain only ASCII letters…
- a repository preview directory requires a dry run
- action prediction payload is too large
- agent ' ' `start_calendar_interval. ` must be between and
AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17).
Data as JSON: /api/errors/89404846466457e0.
Report an issue: GitHub.
Appendix: source
Thrown at src/system/firewall.rs:1046
command_output(
"firewall-cmd",
&["--permanent", &format!("--info-policy={policy}")],
)
.is_ok_and(|output| output.status.success())
})
}
FirewallBackend::Ufw => backend_active(backend),
FirewallBackend::Auto => false,
}
}
fn validate_backend_request(request: &FirewallRequest, backend: FirewallBackend) -> Result<()> {
for rule in &request.rules {
if rule.action == FirewallAction::Limit {
if rule.direction != FirewallDirection::Incoming
|| rule.protocol != Some(FirewallProtocol::Tcp)
{
bail!(
"firewall rule '{}' uses action = \"limit\", which requires direction = \"incoming\" and protocol = \"tcp\"",
rule.name
);
}
if backend == FirewallBackend::Firewalld {
bail!(
"firewall rule '{}' uses per-source connection limiting, which firewalld policies cannot express safely; select backend = \"nftables\" or \"ufw\"",
rule.name
);
}
}
if backend == FirewallBackend::Firewalld && rule.interface.is_some() {
bail!(
"firewall rule '{}' uses interface matching, which firewalld policies cannot express safely; select backend = \"nftables\" or \"ufw\"",
rule.name
);
}
if backend == FirewallBackend::UfwView on GitHub (pinned to 533346cc37)