{"record":{"id":"c55bbbba8eea88d0","repo":"jdx/mise","slug":"bootstrap-plan-contains-resources-with-unknown-sta","errorCode":null,"errorMessage":"bootstrap plan contains resources with unknown state","messagePattern":"bootstrap plan contains resources with unknown state","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cli/bootstrap.rs","lineNumber":1963,"sourceCode":"                    resource.action.to_string(),\n                    resource.id.to_string(),\n                    resource.current.clone(),\n                    resource.desired.clone(),\n                ]);\n            }\n            table.print()?;\n            miseprintln!(\n                \"Plan: {} create, {} update, {} unchanged, {} remove, {} unknown\",\n                output.summary.create,\n                output.summary.update,\n                output.summary.unchanged,\n                output.summary.remove,\n                output.summary.unknown,\n            );\n        }\n        if self.detailed_exitcode {\n            if output.summary.has_unknown() {\n                bail!(\"bootstrap plan contains resources with unknown state\");\n            }\n            if output.summary.has_changes() {\n                return Err(crate::request_exit(2));\n            }\n        }\n        Ok(())\n    }\n}\n\nimpl BootstrapApplySystemPlan {\n    fn run(self) -> Result<()> {\n        system::managed_files::apply_privileged_plan_from_stdin()\n    }\n}\n\nimpl BootstrapApplyAccountPlan {\n    fn run(self) -> Result<()> {\n        system::accounts::apply_privileged_plan_from_stdin()","sourceCodeStart":1945,"sourceCodeEnd":1981,"githubUrl":"https://github.com/jdx/mise/blob/9dcfcaa0dc8747a2577d3270b69bb9d8313b2807/src/cli/bootstrap.rs#L1945-L1981","documentation":"Bailed from the bootstrap plan command (src/cli/bootstrap.rs:1963) when --detailed-exitcode is set and the plan summary has_unknown(). With that flag mise uses terraform-like exit codes (2 = changes present); resources whose current state could not be determined turn the run into a hard error instead of an ambiguous 2, so automation never applies on top of unreadable state.","triggerScenarios":"'mise bootstrap plan --detailed-exitcode' where at least one managed resource could not be compared - permission denied while stat-ing a target file/symlink, a target removed mid-plan, or a state source unreadable by the current user.","commonSituations":"CI pipelines gating bootstrap apply on the exit code; a plan run as an unprivileged user against root-owned managed files; managed dotfiles with restrictive modes.","solutions":["Re-run 'mise bootstrap plan' without --detailed-exitcode and read the plan table rows counted as unknown to identify the resources","Fix permissions/ownership on those targets (or run the plan with the needed privileges), then re-plan","Adjust the bootstrap config if those resources should not be managed on this host","Gate on exit code 2 only once the plan reports 0 unknown"],"exampleFix":"# before (CI gate)\nmise bootstrap plan --detailed-exitcode; rc=$?; [ $rc -eq 2 ] && mise bootstrap apply\n# Error: bootstrap plan contains resources with unknown state\n\n# after\nmise bootstrap plan                          # inspect and fix 'unknown' rows first\nmise bootstrap plan --detailed-exitcode; rc=$?\n[ $rc -eq 2 ] && mise bootstrap apply","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"# bash: treat --detailed-exitcode like terraform (0 clean, 2 changes, else hard fail)\nset +e; mise bootstrap plan --detailed-exitcode; rc=$?; set -e\ncase \"$rc\" in\n  0) echo 'no changes' ;;\n  2) mise bootstrap apply ;;\n  *) echo \"plan failed (rc=$rc) - resolve unknown-state resources first\" >&2; exit \"$rc\" ;;\nesac","preventionTips":["Run plans as a user that can stat every managed file","Resolve 'unknown' rows before gating CI on exit code 2","Keep managed-file permissions aligned with the user running the plan"],"tags":["mise","bootstrap","plan","detailed-exitcode","permissions"],"backgroundTag":"plan-unknown-state","analyzedSha":"9dcfcaa0dc8747a2577d3270b69bb9d8313b2807","analyzedAt":"2026-08-17T14:28:50.624Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}