jdx/mise · error
brew-cask: completion artifact '{}' was not staged
Error message
brew-cask: completion artifact '{}' was not staged What it means
While linking shell completions, the expected completion file is missing from the caskroom: `caskroom_completion_path` derives where the completion should have been staged, and `!is_file()` there aborts before the target symlink is created. Earlier artifact steps are expected to have moved or copied the file into the caskroom first.
Source
Thrown at src/system/packages/brew/cask.rs:4124
let caskroom_completion = caskroom_completion_path(caskroom, &target)?;
if let Some(parent) = caskroom_completion.parent() {
file::create_dir_all(parent)?;
}
let output = generate_completion_output(&executable, completion, *shell)?;
crate::file::write(caskroom_completion, output)?;
}
Ok(())
}
fn link_completion(
cask: &Cask,
artifacts: &CaskArtifacts,
caskroom: &Path,
target: &Path,
) -> Result<()> {
let caskroom_completion = caskroom_completion_path(caskroom, target)?;
if !caskroom_completion.is_file() {
bail!(
"brew-cask: completion artifact '{}' was not staged",
target.display()
);
}
if let Some(parent) = target.parent() {
create_dir_all_elevating(parent)?;
}
ensure_completion_target_replaceable(cask, artifacts, target)?;
make_symlink_elevating(&caskroom_completion, target)?;
Ok(())
}
fn ensure_completion_target_replaceable(
cask: &Cask,
artifacts: &CaskArtifacts,
target: &Path,
) -> Result<()> {
let Ok(metadata) = target.symlink_metadata() else {View on GitHub (pinned to 6f52dcdf99)
Solutions
- Inspect the cask's caskroom directory and confirm the completion file is staged where the artifact expects it
- Fix the completion artifact's source, or the preceding move/copy steps, so the file lands in the caskroom
- Remove the cask's caskroom directory and reinstall to eliminate partial staging
- If the completion is generated rather than shipped, use the generated-completions artifact instead of a staged file
Example fix
# before
completion(source: "#{appdir}/MyApp.app/Contents/Resources/_myapp", target: "#{data}/zsh/site-functions/_myapp")
# after - a move step stages the file into the caskroom first
move(source: "MyApp.app/Contents/Resources/_myapp", target: "completions/_myapp")
completion(source: "completions/_myapp", target: "#{data}/zsh/site-functions/_myapp") Defensive patterns
Strategy: fallback
Validate before calling
// Before linking completions, confirm the artifact was actually staged
let caskroom_completion = caskroom_completion_path(caskroom, target)?;
if !caskroom_completion.is_file() {
// choose: skip completion linking (install continues) or fail with context
warn!("completion '{}' not staged; skipping", target.display());
return Ok(());
} Try / catch
if err.to_string().contains("completion artifact") && err.to_string().contains("was not staged") {
// degrade gracefully: finish the install without completions and queue a re-stage
} Prevention
- Order artifact steps so the completion file is moved/copied into the caskroom before linking
- Use generated-completions for tools that emit completions at runtime
- Wipe the caskroom on interrupted installs to avoid partial staging
When it happens
Trigger: A `completion` artifact whose source file was never placed into the caskroom (a preceding move/copy step failed for it, the payload renamed the file, or the app bundle lacks it); a stale partial caskroom left by an interrupted install.
Common situations: Upstream app dropped or renamed its completion file between releases; an install retried after interrupted staging; a completion source path typo in the cask definition.
Related errors
- brew-cask: structured copy source '{}' was not found
- brew-cask: structured move source '{}' was not found
- brew-cask: structured move with multiple sources requires a
- brew-cask: structured copy source must resolve to exactly on
- brew-cask: structured directory copy requires recursive=true
AI-assisted analysis of jdx/mise@6f52dcdf99 (2026-08-22).
Data as JSON: /api/errors/1defda1f6622c1f9.
Report an issue: GitHub.