jdx/mise · error

refusing unsafe change to bootstrap service

Error message

refusing unsafe change to bootstrap service '{}'; inspect `mise bootstrap plan`

What it means

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.

Solutions

  1. Run `mise bootstrap plan` to see exactly what change mise is refusing and why
  2. Reconcile the service config/state so it maps to a known action (explicit state/enabled/masked values)
  3. Refresh or remove stale bootstrap state, then re-apply
  4. If reproducible with a clean config, report it as a bug with the plan output
Defensive patterns

Strategy: try-catch

Validate before calling

// inspect the planned actions before applying
let plan = mise_bootstrap_plan()?;
for action in &plan {
    if action.status == "unknown" {
        eprintln!("refusing: {} has an unmapped change; reconcile config first", action.name);
    }
}

Try / catch

match apply_result {
    Err(e) if e.to_string().contains("refusing unsafe change") => {
        eprintln!("{}", e);
        eprintln!("run `mise bootstrap plan` and reconcile the service config");
    }
    other => other?,
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.

Related errors


AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17). Data as JSON: /api/errors/fdb60cab76ebb8d0. Report an issue: GitHub.

Appendix: source

Thrown at src/system/services.rs:266

                state: self.state,
                enabled: self.enabled,
                masked: self.masked,
                on_change: self.on_change,
                dependency_changed,
                notified,
                active: self.is_active(),
            })),
            ResourceAction::Unknown if change.provides_unit && missing => Ok(Some(ServiceAction {
                unit: self.unit.clone(),
                state: self.state,
                enabled: self.enabled,
                masked: self.masked,
                on_change: self.on_change,
                dependency_changed,
                notified,
                active: false,
            })),
            ResourceAction::Unknown => bail!(
                "refusing unsafe change to bootstrap service '{}'; inspect `mise bootstrap plan`",
                self.name
            ),
            ResourceAction::Create | ResourceAction::Remove => {
                unreachable!("service lifecycle requests do not create or remove units")
            }
        }
    }

    fn from_action(action: &ServiceAction) -> Self {
        Self {
            name: action.unit.clone(),
            unit: action.unit.clone(),
            state: action.state,
            enabled: action.enabled,
            masked: action.masked,
            on_change: action.on_change,
            origin: None,

View on GitHub (pinned to 533346cc37)