jdx/mise · error

brew-cask: generate_completions_from_executable requires an…

Error message

brew-cask: generate_completions_from_executable requires an executable

What it means

`generate_completions_from_executable` artifacts must name an executable to run in order to generate shell completions. When the artifact's value parses as an array but is empty (or resolves to an empty executable list), parsing fails because there is no way to produce completions. This is a fail-fast validation so misconfigured casks error at parse time instead of at install time.

Solutions

  1. Add the executable name to the `generate_completions_from_executable` array in the cask definition.
  2. If completions are not needed, remove the `generate_completions_from_executable` artifact stanza entirely.

Example fix

// before
generate_completions_from_executable = []
// after
generate_completions_from_executable = ["mytool"]
Defensive patterns

Strategy: validation

Validate before calling

const arr = cask.generate_completions_from_executable;
if (Array.isArray(arr) && arr.length === 0)
  throw new Error("generate_completions_from_executable requires an executable");

Type guard

function hasExecutable(v) {
  return Array.isArray(v) && v.length > 0 && typeof v[0] === "string";
}

Try / catch

try {
  parseCaskArtifacts(cask);
} catch (err) {
  if (err.message.includes("requires an executable")) {
    // supply an executable or drop the artifact
  } else throw err;
}

Prevention

When it happens

Trigger: A cask defines a `generate_completions_from_executable` artifact whose array value is empty (`generate_completions_from_executable = []`), encountered in `parse_generated_completion_artifact` after the `values.is_empty()` check.

Common situations: Hand-editing a cask's artifacts and deleting the executable entry but leaving the empty table/array, or a templated/generated cask where the executable list evaluated to nothing.

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

Appendix: source

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

        source,
        target: target.or_else(|| declared_target(value)),
    }))
}

pub(super) fn parse_generated_completion_artifact(
    value: &Value,
) -> Result<Option<GeneratedCompletionArtifact>> {
    let Some(generated) = value
        .as_object()
        .and_then(|o| o.get("generate_completions_from_executable"))
    else {
        return Ok(None);
    };
    let Value::Array(values) = generated else {
        return Ok(None);
    };
    if values.is_empty() {
        bail!("brew-cask: generate_completions_from_executable requires an executable");
    }
    let options = values.last().and_then(Value::as_object);
    if let Some(options) = options {
        reject_unsupported_artifact_fields(
            "generate_completions_from_executable",
            options,
            &["base_name", "shell_parameter_format", "shells"],
        )?;
    }
    let command_values = if options.is_some() {
        &values[..values.len() - 1]
    } else {
        values.as_slice()
    };
    let executable = command_values
        .first()
        .and_then(Value::as_str)
        .ok_or_else(|| {

View on GitHub (pinned to 533346cc37)