jdx/mise · error

brew-cask: binary artifact

Error message

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

What it means

This is the fallback branch of the same binary verification: if the caskroom binary path is neither a regular file nor a dangling symlink (i.e. it does not exist at all), the library bails reporting that the binary artifact declared by the cask was never staged. The cask metadata promises a binary at 'binary.source' but staging did not produce it.

Solutions

  1. Verify the cask's binary.source matches an artifact actually present in the staged payload; correct the source path if the upstream renamed it
  2. Check whether staging skipped the payload (e.g. path-rejection logs) and fix the underlying staging failure first
  3. Reinstall the cask at a version whose payload contains the declared binary
  4. Clear cask caches/staging dirs and retry to rule out a stale partial install

Example fix

// before: stanza references an artifact that no longer exists in the payload
Binary { source: "MyApp-old.app/Contents/MacOS/app", .. }
// after
Binary { source: "MyApp.app/Contents/MacOS/app", .. }
Defensive patterns

Strategy: validation

Validate before calling

fn staged_binary_present(caskroom_bin: &Path) -> bool {
    caskroom_bin.symlink_metadata().is_ok()
}
// confirm the declared binary.source exists in the staged payload before install

Try / catch

match install_result {
    Err(e) if e.to_string().contains("was not staged") => {
        // inspect the cask stanza's binary.source vs the staged payload
    }
    r => r?,
}

Prevention

When it happens

Trigger: Installing a cask whose binary stanza references 'binary.source' that was not produced by the staging step — the caskroom path has no symlink_metadata at all. E.g. the payload archive lacked the declared artifact or staging skipped it (see error 1210's 'continue' skip path).

Common situations: Cask stanza lists a binary that the upstream payload no longer ships; a cask version upgrade renamed the artifact; staging skipped the payload due to a rejected/relative-path mismatch, leaving the target absent.

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

Appendix: source

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

    }
    target_app_dir()
}

fn link_binary(caskroom: &Path, appdir: &Path, binary: &BinaryArtifact) -> Result<()> {
    let caskroom_binary = caskroom_binary_path(caskroom, appdir, binary)?;
    if !caskroom_binary.is_file() {
        if caskroom_binary
            .symlink_metadata()
            .is_ok_and(|metadata| metadata.file_type().is_symlink())
        {
            let target = std::fs::read_link(&caskroom_binary)?;
            bail!(
                "brew-cask: binary artifact '{}' was staged but symlink target '{}' does not exist",
                binary.source,
                target.display()
            );
        }
        bail!(
            "brew-cask: binary artifact '{}' was not staged",
            binary.source
        );
    }
    let target = binary.target_path(appdir)?;
    if let Some(parent) = target.parent() {
        create_dir_all_elevating(parent)?;
    }
    make_symlink_elevating(&caskroom_binary, &target)?;
    Ok(())
}

fn link_command_wrapper(caskroom: &Path, wrapper: &CommandWrapperArtifact) -> Result<()> {
    let source = wrapper.caskroom_path(caskroom);
    if !source.is_file() {
        bail!(
            "brew-cask: command wrapper '{}' was not staged",
            wrapper.name

View on GitHub (pinned to 533346cc37)