jdx/mise · error

BootstrapPart values have clap names

Error message

BootstrapPart values have clap names

What it means

bootstrap_part_name converts a BootstrapPart enum value to its clap name via `part.to_possible_value().expect("BootstrapPart values have clap names")` (src/cli/bootstrap.rs:2468-2473). Because BootstrapPart derives clap's ValueEnum, every variant has a possible value with a name; the expect only fails if a variant is added without ValueEnum support (e.g. a custom impl or #[value(skip)] variant). It is a compile-time-adjacent invariant enforced at runtime.

Source

Thrown at src/cli/bootstrap.rs:2469

    }
    if all {
        for (name, host) in inventory {
            selected.entry(name.clone()).or_insert_with(|| host.clone());
        }
    }
    if !tags.is_empty() {
        for (name, host) in inventory {
            if tags.iter().any(|tag| host.tags.contains(tag)) {
                selected.entry(name.clone()).or_insert_with(|| host.clone());
            }
        }
    }
    Ok(selected)
}

fn bootstrap_part_name(part: &BootstrapPart) -> String {
    part.to_possible_value()
        .expect("BootstrapPart values have clap names")
        .get_name()
        .to_string()
}

impl BootstrapSecretsStatus {
    async fn run(self) -> Result<()> {
        let config = Config::get().await?;
        let statuses = system::secrets::statuses(&config)?;
        let unavailable = statuses
            .iter()
            .any(|status| status.state != system::secrets::SecretState::Available);
        if self.json {
            miseprintln!("{}", serde_json::to_string_pretty(&statuses)?);
        } else if statuses.is_empty() {
            info!("no bootstrap secret inputs configured");
        } else {
            let mut table = MiseTable::new(false, &["Secret", "Environment", "State"]);
            for status in statuses {

View on GitHub (pinned to 6f52dcdf99)

Solutions

  1. If hit as a user: update mise — the build contains an unsupported bootstrap part variant
  2. As a contributor: ensure every BootstrapPart variant is a plain ValueEnum variant (no #[value(skip)]) or extend the enum's impl so to_possible_value returns a name
  3. Add a unit test asserting to_possible_value().is_some() for all BootstrapPart::value_variants()
  4. Report at https://github.com/jdx/mise/issues

Example fix

// before: variant hidden from clap
#[derive(clap::ValueEnum, Clone)]
enum BootstrapPart {
    Accounts,
    Files,
    #[value(skip)]
    InternalOnly, // to_possible_value() -> None -> panic
}

// after: every variant carries a clap name
#[derive(clap::ValueEnum, Clone)]
enum BootstrapPart {
    Accounts,
    Files,
    InternalOnly, // named; hidden from help via clap's hide mechanism if needed
}
Defensive patterns

Strategy: validation

Prevention

When it happens

Trigger: A contributor adds a new BootstrapPart variant (a new bootstrap part) whose ValueEnum implementation returns None from to_possible_value — then any code path formatting skip/only part names panics. No user input reaches it: the parts come from the fixed enum, parsed by clap itself.

Common situations: Development of new bootstrap parts; broken custom builds. End users cannot construct a BootstrapPart that lacks a clap name because clap rejects unknown --skip/--only values before this code runs.

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/c9bfcdc85c941cc9. Report an issue: GitHub.