{"record":{"id":"3edebdd1a540b3be","repo":"jdx/mise","slug":"refusing-unsafe-firewall-change-inspect-mise-boo","errorCode":null,"errorMessage":"refusing unsafe firewall change; inspect `mise bootstrap firewall status`","messagePattern":"refusing unsafe firewall change; inspect `mise bootstrap firewall status`","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/firewall.rs","lineNumber":726,"sourceCode":"        .count();\n    if changes == 0 {\n        info!(\"firewall: already converged\");\n        return Ok(());\n    }\n    if firewall_change_is_unsafe(&plan) {\n        if dry_run {\n            for resource in plan\n                .iter()\n                .filter(|resource| resource.action == ResourceAction::Unknown)\n            {\n                warn!(\n                    \"would not change {}: current {}, desired {} (manual action required)\",\n                    resource.id, resource.current, resource.desired\n                );\n            }\n            return Ok(());\n        }\n        bail!(\"refusing unsafe firewall change; inspect `mise bootstrap firewall status`\");\n    }\n    if dry_run {\n        let inspection = request.inspection.as_ref().expect(\"firewall was inspected\");\n        let backend = inspection.backend.expect(\"available firewall backend\");\n        for command in preview_commands(request, backend)? {\n            miseprintln!(\"would run {}\", shell_words::join(command));\n        }\n        return Ok(());\n    }\n    let destructive = request.exclusive\n        || matches!(\n            request.state,\n            FirewallState::Disabled | FirewallState::Absent\n        )\n        || plan\n            .iter()\n            .any(|resource| resource.action == ResourceAction::Remove);\n    if !yes","sourceCodeStart":708,"sourceCodeEnd":744,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/firewall.rs#L708-L744","documentation":"The firewall apply step computes a plan and validates it against safety invariants (no lockout, no manual-intervention resources). If a resource is in a state mise cannot safely change automatically (e.g. drift it would have to force) or the plan is otherwise unsafe, apply bails out with this generic refusal instead of mutating the firewall. The error directs you to the read-only inspection command for details.","triggerScenarios":"Running `mise bootstrap firewall apply` when the plan contains resources whose current state differs from desired in a way flagged manual-action-required, or when a safety check upstream failed and apply reached the terminal bail in FirewallRequest::apply.","commonSituations":"Hand-edited nftables/ufw state diverging from what mise manages; rules created by another tool (Docker, firewalld zones) conflicting with the plan; partial previous apply that left drifted resources; concurrent firewall changes from another admin.","solutions":["Run `mise bootstrap firewall status` to see the current vs desired state and which resource is unsafe.","Reconcile the drifted resource manually (delete/fix the conflicting rule) so the plan becomes safe.","Re-run apply after the manual fix; verify with a dry run first.","If allow_lockout gating was the cause, add a covering SSH allow rule or set allow_lockout = true, then retry."],"exampleFix":"// before\n$ mise bootstrap firewall apply\nerror: refusing unsafe firewall change...\n\n// after\n$ mise bootstrap firewall status   # inspect current vs desired\n$ # fix conflicting rule manually, then:\n$ mise bootstrap firewall apply","handlingStrategy":"try-catch","validationCode":"// inspect first, apply second\nlet status = cmd(\"mise\").args([\"bootstrap\", \"firewall\", \"status\"]).output()?;\nprintln!(\"{}\", String::from_utf8_lossy(&status.stdout)); // confirm plan is clean before apply","typeGuard":null,"tryCatchPattern":"match result {\n    Err(e) if e.to_string().contains(\"refusing unsafe firewall change\") => {\n        let status = cmd(\"mise\").args([\"bootstrap\", \"firewall\", \"status\"]).output()?;\n        eprintln!(\"unsafe plan; inspect:\\n{}\", String::from_utf8_lossy(&status.stdout));\n    }\n    other => other?,\n}","preventionTips":["Always run status / dry run before apply.","Avoid hand-editing nftables/ufw/firewalld state on hosts mise manages.","Investigate drift immediately after other tools (Docker, etc.) touch the firewall.","Run applies serially; never concurrently from multiple automation jobs."],"tags":["firewall","safety-check","state-drift","apply-refused"],"backgroundTag":"invalid-state-transition","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"}