jdx/mise · error

brew-cask: cannot adopt '{}': existing artifact is not ident

Error message

brew-cask: cannot adopt '{}': existing artifact is not identical to the cask artifact

What it means

During artifact installation with adoption enabled (src/system/packages/brew/cask.rs:1287), mise can adopt an app already present at the destination instead of overwriting it. With verify_adopt set it fingerprints both the staged artifact and the existing target (cask_target_fingerprint); a mismatch means the bytes on disk are not the exact artifact this cask would install, so adoption is refused rather than silently replacing something else.

Source

Thrown at src/system/packages/brew/cask.rs:1287

    // only by name relative to that descriptor. Nothing below resolves a
    // pathname for the application directory, so a post-validation replacement
    // of any appdir component — even by the same uid — cannot redirect the
    // copy, rename, removal, permission repair, or quarantine steps.
    let parent = ensure_trusted_appdir(
        logical_target
            .parent()
            .ok_or_else(|| eyre!("brew-cask: app target has no parent directory"))?,
    )?;
    let name = logical_target
        .file_name()
        .ok_or_else(|| eyre!("brew-cask: app target has no filename"))?
        .to_owned();
    if adopt && exists_at(&parent.fd, &name)? {
        if verify_adopt {
            let source_fingerprint = cask_target_fingerprint(&source)?;
            let target_fingerprint = cask_target_fingerprint(&logical_target)?;
            if source_fingerprint != target_fingerprint {
                bail!(
                    "brew-cask: cannot adopt '{}': existing artifact is not identical to the cask artifact",
                    logical_target.display()
                );
            }
        }
        return Ok(true);
    }

    ditto(&source, &caskroom_app)?;
    // Suffix hashes stay derived from the logical path so temporary and backup
    // names are stable across runs.
    let name_hash = crate::hash::hash_to_str(&logical_target.display().to_string());
    let tmp_name = replace_bundle_extension(&name, &format!("mise-tmp-{name_hash}"));
    let old_name = replace_bundle_extension(&name, &format!("mise-old-{name_hash}"));
    remove_all_at(&parent.fd, &tmp_name)?;
    ditto_into(&caskroom_app, &parent.fd, &tmp_name)?;
    activate_app_at(
        &parent,

View on GitHub (pinned to 6f52dcdf99)

Solutions

  1. Quit and remove (or move aside) the existing app at the path shown in the error, then retry the mise install
  2. Disable adoption for that cask token so mise performs its normal install flow instead of the adopt path
  3. If the existing app is simply an older build of the same app, removing it and installing via the cask is the clean path

Example fix

# before
$ mise install brew-cask:foo   # adopt fails: existing /Applications/Foo.app differs

# after
$ mv /Applications/Foo.app ~/Desktop/Foo.app.bak
$ mise install brew-cask:foo
Defensive patterns

Strategy: validation

Validate before calling

if adopt && target_exists {
    let staged = cask_target_fingerprint(&staged_app)?;
    let existing = cask_target_fingerprint(&target_path)?;
    if staged != existing {
        return Err(anyhow!("existing app differs from cask artifact - move it aside or disable adopt"));
    }
}

Type guard

fn adoptable(staged_fp: &str, existing_fp: &str) -> bool { staged_fp == existing_fp }

Prevention

When it happens

Trigger: The brew_cask_adopt manager option is on for a token, the target app already exists at its destination path, and verify_adopt is requested — the fingerprint comparison (content identity of app bundles) fails because the installed app differs from the cask artifact.

Common situations: Apps downloaded from the vendor site before switching to mise; apps whose in-app updater rewrote the bundle so it no longer matches the cask's bytes; adoption enabled broadly in config across machines with drifted installs.

Related errors


AI-assisted analysis of jdx/mise@6f52dcdf99 (2026-08-22). Data as JSON: /api/errors/477cac109bd6e8ee. Report an issue: GitHub.