jdx/mise · error

system files were preflighted when not skipped

Error message

system files were preflighted when not skipped

What it means

A `.expect()` panic in mise's bootstrap system-files phase (src/cli/bootstrap.rs:1519). It asserts that when the Files part is not skipped, the earlier preflight stored its result in `managed_system_files`. Panicking means the file phase ran without the preflight ever populating that value.

Solutions

  1. Ensure preflight always runs when BootstrapPart::Files is not skipped
  2. Clone/store the preflight result into managed_system_files before dispatching phases
  3. Change the phase to run preflight lazily if managed_system_files is None

Example fix

// before
let (mut files, mut directories) = managed_system_files.as_ref().expect("system files were preflighted when not skipped").clone();
// after
let (mut files, mut directories) = match managed_system_files.as_ref() { Some(v) => v.clone(), None => preflight_managed_files(&config)? };
Defensive patterns

Strategy: validation

Validate before calling

if !skip.contains(&BootstrapPart::Files) && managed_system_files.is_none() { return Err(anyhow!("system files preflight missing")); }

Type guard

fn preflighted(v: &Option<(Vec<FileRequest>, Vec<DirRequest>)>) -> bool { v.is_some() }

Try / catch

let Some(preflighted) = managed_system_files.as_ref() else { bail!("system files phase requires preflight") };

Prevention

When it happens

Trigger: The Files part is executed (not in the skip list) but `managed_system_files` is None — the preflight pass that builds managed files/directories was not run, failed silently, or its result was dropped before this phase.

Common situations: Partial bootstrap invocations where phases are reordered; test harnesses that call the files phase directly without the preflight; refactors removing the preflight call.

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@afd2eddd3a (2026-09-09). Data as JSON: /api/errors/81db7632567b3d3d. Report an issue: GitHub.

Appendix: source

Thrown at src/cli/bootstrap.rs:1519

                    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(&config, &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 afd2eddd3a)