jdx/mise · error

brew-cask: completion artifact

Error message

brew-cask: completion artifact '{}' was not staged

What it means

After a cask's completion (symlink/link) artifact is staged into the caskroom, mise links it to its final target. Before linking it calls caskroom_completion_path and checks that the staged file actually exists in the caskroom. If the staged artifact is missing, it bails rather than silently creating a dangling link, indicating the staging step did not produce the expected artifact.

Solutions

  1. Re-run the cask install so staging completes and the artifact is present in the caskroom.
  2. Remove the incomplete caskroom version directory (`mise uninstall` then reinstall the cask).
  3. Check the cask's artifact definition: the staged completion source must match what the install stages.
  4. Verify disk space/permissions on the caskroom path so staging isn't silently failing.

Example fix

// before: installing on top of a partially staged caskroom
mise install cask://my-font

// after: clear the incomplete staging first, then reinstall
mise uninstall cask://my-font && mise install cask://my-font
Defensive patterns

Strategy: validation

Validate before calling

use std::path::Path;
fn staged_artifact_present(caskroom: &Path, target: &Path) -> bool {
    caskroom_completion_path(caskroom, target)
        .map(|p| p.is_file())
        .unwrap_or(false)
}
// check before invoking the completion/link step

Try / catch

// Rust
match install_cask_completion(&cask, &artifacts, &caskroom, &target) {
    Err(e) if e.to_string().contains("was not staged") => {
        // clean the caskroom version dir and retry the install once
    }
    Ok(()) => {}
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Installing a cask whose artifacts declare a completion target, but the expected staged file at caskroom_completion_path(caskroom, target) does not exist as a file — staging was skipped, partially failed, or the artifact source name doesn't match what was staged.

Common situations: Interrupted or partially completed cask install left the caskroom incomplete; a cask definition expects an artifact the installer never staged (upstream cask changed artifact layout); manual deletion of caskroom contents; version directory mismatch after an upgrade.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


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

Appendix: source

Thrown at src/system/packages/brew/cask/mod.rs:2883

        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 533346cc37)