{"record":{"id":"fdb60cab76ebb8d0","repo":"jdx/mise","slug":"refusing-unsafe-change-to-bootstrap-service","errorCode":null,"errorMessage":"refusing unsafe change to bootstrap service '{}'; inspect `mise bootstrap plan`","messagePattern":"refusing unsafe change to bootstrap service '(.+?)'; inspect `mise bootstrap plan`","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/services.rs","lineNumber":266,"sourceCode":"                state: self.state,\n                enabled: self.enabled,\n                masked: self.masked,\n                on_change: self.on_change,\n                dependency_changed,\n                notified,\n                active: self.is_active(),\n            })),\n            ResourceAction::Unknown if change.provides_unit && missing => Ok(Some(ServiceAction {\n                unit: self.unit.clone(),\n                state: self.state,\n                enabled: self.enabled,\n                masked: self.masked,\n                on_change: self.on_change,\n                dependency_changed,\n                notified,\n                active: false,\n            })),\n            ResourceAction::Unknown => bail!(\n                \"refusing unsafe change to bootstrap service '{}'; inspect `mise bootstrap plan`\",\n                self.name\n            ),\n            ResourceAction::Create | ResourceAction::Remove => {\n                unreachable!(\"service lifecycle requests do not create or remove units\")\n            }\n        }\n    }\n\n    fn from_action(action: &ServiceAction) -> Self {\n        Self {\n            name: action.unit.clone(),\n            unit: action.unit.clone(),\n            state: action.state,\n            enabled: action.enabled,\n            masked: action.masked,\n            on_change: action.on_change,\n            origin: None,","sourceCodeStart":248,"sourceCodeEnd":284,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/services.rs#L248-L284","documentation":"When computing actions after a daemon reload, a service resource can land in an Unknown action state — meaning the requested change cannot be mapped to a known, safe systemd operation. Instead of guessing, mise refuses and directs the user to `mise bootstrap plan` to inspect what would change.","triggerScenarios":"commands_after_reload (during bootstrap apply) asks a Service resource for its action and it resolves to ResourceAction::Unknown — e.g. an internal state combination the planner cannot translate into create/remove/start/stop/mask operations.","commonSituations":"A partially-updated or hand-edited bootstrap state drifting from what the planner expects, version-mismatched state files, or a bug/edge case in action derivation; often after daemon reload with concurrently changed config.","solutions":["Run `mise bootstrap plan` to see exactly what change mise is refusing and why","Reconcile the service config/state so it maps to a known action (explicit state/enabled/masked values)","Refresh or remove stale bootstrap state, then re-apply","If reproducible with a clean config, report it as a bug with the plan output"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// inspect the planned actions before applying\nlet plan = mise_bootstrap_plan()?;\nfor action in &plan {\n    if action.status == \"unknown\" {\n        eprintln!(\"refusing: {} has an unmapped change; reconcile config first\", action.name);\n    }\n}","typeGuard":null,"tryCatchPattern":"match apply_result {\n    Err(e) if e.to_string().contains(\"refusing unsafe change\") => {\n        eprintln!(\"{}\", e);\n        eprintln!(\"run `mise bootstrap plan` and reconcile the service config\");\n    }\n    other => other?,\n}","preventionTips":["Always review `mise bootstrap plan` before apply","Keep bootstrap state and config in sync; avoid concurrent edits during daemon reload","Explicitly set state/enabled/masked so every service maps to a known action","Report persistent Unknown states with plan output as a bug"],"tags":["services","safety-guard","bootstrap","internal-state"],"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"}