jdx/mise · error

system files were preflighted when not skipped

Error message

system files were preflighted when not skipped

What it means

Internal invariant in the apply phase of `mise bootstrap`. `managed_system_files` is Some exactly when the files part is enabled (`!skip.contains(&BootstrapPart::Files)`, src/cli/bootstrap.rs:1146-1152). At apply time the code re-checks `skip.contains(&BootstrapPart::Files)` and unwraps managed_system_files with this expect — the two conditions are complements, so the expect holds unless the skip set or the Option goes out of sync between preflight and apply.

Source

Thrown at src/cli/bootstrap.rs:1297

                    dry_run: self.dry_run,
                    update: self.update,
                    yes: self.yes,
                };
                driver::run(mgrs, Action::Install, &opts).await?;
            }
            if !has_plugin_packages {
                self.run_hooks(&hooks, BootstrapHookPhase::PostPackages)
                    .await?;
                post_packages_ran = true;
            }
        }

        if skip.contains(&BootstrapPart::Files) {
            debug!("bootstrap: system files skipped");
        } else {
            let (mut files, mut directories) = managed_system_files
                .as_ref()
                .expect("system files were preflighted when not skipped")
                .clone();
            system::managed_files::inspect_requests(&mut files, &mut directories)?;
            if files.is_empty() && directories.is_empty() {
                debug!("bootstrap: no [bootstrap.files] or [bootstrap.directories] configured");
            } else {
                info!("bootstrap: system files");
                let report = system::managed_files::apply_with_accounts(
                    &files,
                    &directories,
                    configured_accounts.as_ref(),
                    allow_pending_accounts,
                    self.dry_run,
                    self.yes,
                )?;
                notified_services = report.notified_services;
            }
        }

View on GitHub (pinned to 6f52dcdf99)

Solutions

  1. If hit as a user: update/pin mise — internal bug, not config
  2. Workaround: `mise bootstrap --skip=files` keeps both sides of the invariant on the skip path
  3. As a contributor: compute `files_enabled` once and reuse it for both the Option construction and the apply-time check instead of re-reading skip
  4. Report at https://github.com/jdx/mise/issues with the backtrace

Example fix

// before: skip re-evaluated at apply time, can diverge from preflight
if skip.contains(&BootstrapPart::Files) { ... } else {
    managed_system_files.as_ref().expect("system files were preflighted when not skipped");
}

// after: reuse the preflight boolean
if !files_enabled { debug!("bootstrap: system files skipped"); } else {
    let (mut files, mut directories) = managed_system_files
        .expect("files_enabled implies preflight") // single source of truth
        .clone();
}
Defensive patterns

Strategy: fallback

Prevention

When it happens

Trigger: Only a code change that mutates `skip` or `managed_system_files` between preflight and the apply phase (e.g. a mid-run skip_parts() change), making files not-skipped while the Option is None — panics at the 'bootstrap: system files' step. No user configuration reaches it: `--skip=files` keeps both sides consistent.

Common situations: Contributors adding conditional file-part toggling mid-run; broken builds. Ordinary runs with or without --skip=files, --dry-run, or hooks do not hit it.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


AI-assisted analysis of jdx/mise@6f52dcdf99 (2026-08-22). Data as JSON: /api/errors/81db7632567b3d3d. Report an issue: GitHub.