jdx/mise · error

bootstrap command is registered

Error message

bootstrap command is registered

What it means

mise defers building some clap subcommand trees for startup speed; expand_deferred_subcommands re-attaches the full `bootstrap` command for full-tree introspection such as generated docs and validation, doing `command.find_subcommand_mut("bootstrap").expect("bootstrap command is registered")` (src/cli/mod.rs:281-288). The expect asserts the literal name "bootstrap" still exists in the Commands enum's clap tree.

Source

Thrown at src/cli/mod.rs:286

    Uninstall(uninstall::Uninstall),
    Unset(unset::Unset),
    Untrust(untrust::Untrust),
    Unuse(unuse::Unuse),
    Upgrade(upgrade::Upgrade),
    Usage(usage::Usage),
    Use(r#use::Use),
    Version(version::Version),
    Watch(Box<watch::Watch>),
    Where(r#where::Where),
    Which(which::Which),
}

/// Expand command sections that are deferred during normal startup. Use this
/// only for full-tree introspection such as generated docs and validation.
pub(crate) fn expand_deferred_subcommands(mut command: clap::Command) -> clap::Command {
    *command
        .find_subcommand_mut("bootstrap")
        .expect("bootstrap command is registered") = bootstrap::full_command();
    command
}

impl Commands {
    fn implicitly_trusts_active_config(&self) -> bool {
        matches!(
            self,
            Self::Exec(_) | Self::Install(_) | Self::Run(_) | Self::Watch(_)
        )
    }

    pub(crate) async fn run(self) -> Result<()> {
        match self {
            Self::Activate(cmd) => cmd.run(),
            Self::ToolAlias(cmd) => cmd.run().await,
            Self::Asdf(cmd) => cmd.run().await,
            Self::Backends(cmd) => cmd.run().await,
            Self::BinPaths(cmd) => cmd.run().await,

View on GitHub (pinned to 6f52dcdf99)

Solutions

  1. As a contributor: keep the subcommand named "bootstrap" or update the lookup string in expand_deferred_subcommands in the same PR
  2. Run `mise run render` (docs/usage generation) after any CLI command changes to catch this in CI
  3. If hit as a user of a broken build: update mise; there is no runtime workaround

Example fix

// before: command renamed but lookup not updated
Use(r#use::Use),
MiseBootstrap(bootstrap::Bootstrap), // clap name is now "mise-bootstrap"
...find_subcommand_mut("bootstrap").expect("bootstrap command is registered") // None -> panic

// after: rename and lookup stay in sync
Bootstrap(bootstrap::Bootstrap), // clap name "bootstrap"
...find_subcommand_mut("bootstrap").expect("bootstrap command is registered")
Defensive patterns

Strategy: validation

Prevention

When it happens

Trigger: Running anything that expands the deferred tree (docs generation / render tasks, CLI validation) in a build where the bootstrap command was renamed, removed from Commands, or given a different clap name — find_subcommand_mut returns None and the process panics. Not reachable by end-user CLI invocation; the function is pub(crate) for internal introspection.

Common situations: Contributors renaming/removing the bootstrap subcommand or changing its clap attributes while docs generation still looks it up by string; CI `mise run render` failing after such a change.

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