{"record":{"id":"71bc62808a396d28","repo":"jdx/mise","slug":"bootstrap-command-is-registered","errorCode":null,"errorMessage":"bootstrap command is registered","messagePattern":"bootstrap command is registered","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cli/mod.rs","lineNumber":286,"sourceCode":"    Uninstall(uninstall::Uninstall),\n    Unset(unset::Unset),\n    Untrust(untrust::Untrust),\n    Unuse(unuse::Unuse),\n    Upgrade(upgrade::Upgrade),\n    Usage(usage::Usage),\n    Use(r#use::Use),\n    Version(version::Version),\n    Watch(Box<watch::Watch>),\n    Where(r#where::Where),\n    Which(which::Which),\n}\n\n/// Expand command sections that are deferred during normal startup. Use this\n/// only for full-tree introspection such as generated docs and validation.\npub(crate) fn expand_deferred_subcommands(mut command: clap::Command) -> clap::Command {\n    *command\n        .find_subcommand_mut(\"bootstrap\")\n        .expect(\"bootstrap command is registered\") = bootstrap::full_command();\n    command\n}\n\nimpl Commands {\n    fn implicitly_trusts_active_config(&self) -> bool {\n        matches!(\n            self,\n            Self::Exec(_) | Self::Install(_) | Self::Run(_) | Self::Watch(_)\n        )\n    }\n\n    pub(crate) async fn run(self) -> Result<()> {\n        match self {\n            Self::Activate(cmd) => cmd.run(),\n            Self::ToolAlias(cmd) => cmd.run().await,\n            Self::Asdf(cmd) => cmd.run().await,\n            Self::Backends(cmd) => cmd.run().await,\n            Self::BinPaths(cmd) => cmd.run().await,","sourceCodeStart":268,"sourceCodeEnd":304,"githubUrl":"https://github.com/jdx/mise/blob/6f52dcdf99e282ef7a7db68c81301fa4618d0f79/src/cli/mod.rs#L268-L304","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["As a contributor: keep the subcommand named \"bootstrap\" or update the lookup string in expand_deferred_subcommands in the same PR","Run `mise run render` (docs/usage generation) after any CLI command changes to catch this in CI","If hit as a user of a broken build: update mise; there is no runtime workaround"],"exampleFix":"// before: command renamed but lookup not updated\nUse(r#use::Use),\nMiseBootstrap(bootstrap::Bootstrap), // clap name is now \"mise-bootstrap\"\n...find_subcommand_mut(\"bootstrap\").expect(\"bootstrap command is registered\") // None -> panic\n\n// after: rename and lookup stay in sync\nBootstrap(bootstrap::Bootstrap), // clap name \"bootstrap\"\n...find_subcommand_mut(\"bootstrap\").expect(\"bootstrap command is registered\")","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Contributors: run mise run render after changing any clap command names so CI catches missing subcommands","Keep subcommand lookup strings in sync with clap names in the same change","Users: update mise; no runtime workaround exists for a broken command tree"],"tags":["cli","docs-generation","invariant","panic","internal"],"backgroundTag":"internal-invariant-violation","analyzedSha":"6f52dcdf99e282ef7a7db68c81301fa4618d0f79","analyzedAt":"2026-08-22T10:14:23.840Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}