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
Thrown while parsing a generate_completions_from_executable artifact. The stanza is an array whose first element must be the executable (string) that generates completions, optionally followed by args and a trailing options object. An empty array provides no executable, so parsing fails immediately; a non-string first element fails the same way via the follow-on lookup.
Source
Thrown at src/system/packages/brew/cask.rs:5381
}
_ => Ok(None),
}
}
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);
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(|| {
eyre!("brew-cask: generate_completions_from_executable requires an executable")
})?
.to_string();
let args = command_values
.iter()
.skip(1)
.map(|value| {View on GitHub (pinned to 6f52dcdf99)
Solutions
- Make the first array element the executable string: ["mycli"] or ["mycli", "completions", "--shell"]
- Keep the optional options object (base_name, shells, shell_parameter_format) as the LAST element, never the first
- If the cask JSON is upstream and malformed, update mise/brew metadata caches and report the cask token
Example fix
// before
{"generate_completions_from_executable": []}
// after
{"generate_completions_from_executable": ["mycli", {"shells": ["bash", "zsh"]}]} Defensive patterns
Strategy: validation
Validate before calling
fn completions_artifact_ok(v: &serde_json::Value) -> bool {
match v.get("generate_completions_from_executable") {
Some(serde_json::Value::Array(a)) => a.first().map(|f| f.is_string()).unwrap_or(false),
_ => true,
}
} Type guard
fn is_completions_stanza(v: &serde_json::Value) -> bool {
matches!(v, serde_json::Value::Array(a) if !a.is_empty() && a[0].is_string())
} Try / catch
match parse_generated_completion_artifact(&artifact) {
Ok(c) => { /* proceed */ }
Err(e) if e.to_string().contains("requires an executable") => {
eprintln!("completions stanza needs the generator binary as the first array element");
}
Err(e) => return Err(e),
} Prevention
- Always start the array with the executable string; options object goes last
- Omit the stanza entirely for CLI tools without completion support
- Never ship empty placeholder arrays from templates
When it happens
Trigger: {"generate_completions_from_executable": []} in a cask's artifact list; also an array whose first element is a number/object (e.g. [{"shell": "bash"}, "tool"]) where no string executable can be extracted.
Common situations: Templates or generators that emit the stanza with a placeholder that got emptied; cask JSON hand-authored for completion generation; reordering mistakes where the options object is placed first.
Related errors
- brew-cask: generate_completions_from_executable requires at
- brew-cask: completion executable '{}' is ambiguous: {}
- brew-cask: failed to generate {} completions from {}: {}
- brew-cask: completion target '{}' must not contain '..'
- brew-cask: invalid completion target '{target_name}'
AI-assisted analysis of jdx/mise@6f52dcdf99 (2026-08-22).
Data as JSON: /api/errors/7f33d47940db73e6.
Report an issue: GitHub.