jdx/mise · error

brew-cask: generate_completions_from_executable requires at…

Error message

brew-cask: generate_completions_from_executable requires at least one shell

What it means

A `generate_completions_from_executable` artifact may restrict which shells completions are generated for via its `shells` option. After resolving explicit shells (or falling back to defaults), if the resulting shell list is empty, parsing bails because completions for zero shells are meaningless.

Solutions

  1. List at least one shell in the `shells` option, e.g. `shells = ["bash", "zsh"]`.
  2. Remove the `shells` option to use the default shell set, or remove the artifact stanza if no completions are wanted.

Example fix

// before
[artifacts.generate_completions_from_executable.options]
shells = []
// after
[artifacts.generate_completions_from_executable.options]
shells = ["bash", "zsh"]
Defensive patterns

Strategy: validation

Validate before calling

const opts = cask.generate_completions_from_executable?.options ?? {};
if (Array.isArray(opts.shells) && opts.shells.length === 0)
  throw new Error("shells must list at least one shell");

Type guard

function hasShells(opts) {
  return !opts?.shells || (Array.isArray(opts.shells) && opts.shells.length > 0);
}

Try / catch

try {
  parseCaskArtifacts(cask);
} catch (err) {
  if (err.message.includes("requires at least one shell")) {
    // remove the empty shells option or add shells
  } else throw err;
}

Prevention

When it happens

Trigger: Setting `shells = []` in the artifact options, producing an empty list after `unwrap_or_else(default_generated_completion_shells)` in `parse_generated_completion_artifact`.

Common situations: Explicitly disabling shells by passing an empty array instead of removing the artifact; or editing a shared cask template where the shells list was emptied.

Understand the failure class

Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.

Related errors


AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17). Data as JSON: /api/errors/18e942804eb0edbf. Report an issue: GitHub.

Appendix: source

Thrown at src/system/packages/brew/cask/artifacts.rs:467

    let shells = options
        .and_then(|o| o.get("shells"))
        .and_then(Value::as_array)
        .map(|shells| {
            shells
                .iter()
                .map(|shell| {
                    let shell = shell.as_str().ok_or_else(|| {
                        eyre!("brew-cask: completion shell names must be strings")
                    })?;
                    CompletionShell::parse(shell)
                        .ok_or_else(|| eyre!("brew-cask: unsupported completion shell '{shell}'"))
                })
                .collect::<Result<Vec<_>>>()
        })
        .transpose()?
        .unwrap_or_else(|| default_generated_completion_shells(shell_parameter_format.as_deref()));
    if shells.is_empty() {
        bail!("brew-cask: generate_completions_from_executable requires at least one shell");
    }
    Ok(Some(GeneratedCompletionArtifact {
        executable,
        args,
        base_name: options
            .and_then(|o| o.get("base_name"))
            .and_then(Value::as_str)
            .map(str::to_string),
        shell_parameter_format,
        shells,
    }))
}

pub(super) fn default_generated_completion_shells(format: Option<&str>) -> Vec<CompletionShell> {
    match format {
        Some("cobra") | Some("typer") => vec![
            CompletionShell::Bash,
            CompletionShell::Zsh,

View on GitHub (pinned to 533346cc37)