jdx/mise · error

provider checked above

Error message

provider checked above

What it means

A `.expect()` panic in `mise deps install --explain` (src/cli/deps/install.rs:114). The code assumes a preceding check ensured `--provider` is present whenever `--explain` is used; the expect asserts that. Panicking means `--explain` reached the explain path without a provider, so the upstream guard is missing or bypassed.

Source

Thrown at src/cli/deps/install.rs:114

        let mut ts = match &monorepo_union {
            Some(union) => {
                let mut ts: Toolset = union.tool_request_set.clone().into();
                ts.resolve(&install_config).await?;
                ts
            }
            None => {
                ToolsetBuilder::new()
                    .with_default_to_latest(true)
                    .build(&install_config)
                    .await?
            }
        };

        if self.explain {
            let env = ts.env_with_path(&install_config).await?;
            return Self::explain_provider(
                &engine,
                self.provider.as_deref().expect("provider checked above"),
                &env,
            );
        }

        let install_opts = InstallOptions {
            missing_args_only: false,
            dry_run: self.dry_run,
            ..Default::default()
        };
        ts.install_missing_versions(&mut install_config, &install_opts)
            .await?;

        // Get toolset environment with PATH
        let (env, env_remove) = ts.env_with_path_and_removals(&install_config).await?;

        let opts = DepsOptions {
            dry_run: self.dry_run,
            force: self.force,

View on GitHub (pinned to afd2eddd3a)

Solutions

  1. Pass `--provider <name>` together with `--explain`
  2. Restore/verify the early guard that errors when explain is set without provider
  3. Return a clap validation error instead of panicking (make --provider required_with "explain")

Example fix

// before
self.provider.as_deref().expect("provider checked above")
// after
self.provider.as_deref().ok_or_else(|| anyhow!("--provider is required with --explain"))?
Defensive patterns

Strategy: validation

Validate before calling

if self.explain && self.provider.is_none() { return Err(anyhow!("--provider is required with --explain")); }

Type guard

let provider = match (self.explain, self.provider.as_deref()) { (true, Some(p)) => Some(p), (true, None) => return Err(anyhow!("missing --provider")), _ => None };

Try / catch

let Some(provider) = self.provider.as_deref().filter(|_| self.explain) else { return Err(anyhow!("--explain requires --provider")) };

Prevention

When it happens

Trigger: Running `mise deps install --explain` without `--provider` when the validation earlier in `run` does not actually reject that combination (e.g. provider default logic changed or the check was removed).

Common situations: Calling the explain code path programmatically or via a new subcommand wrapper that skips the argument validation; CLI changes that made --provider optional.

Understand the failure class

Background: "--flag is required" and "must specify" CLI errors: how missing-required-flag validation works and how to fix it — this error's family across 20 libraries.

Related errors


AI-assisted analysis of jdx/mise@afd2eddd3a (2026-09-09). Data as JSON: /api/errors/ca071ac2d58b6fff. Report an issue: GitHub.