{"record":{"id":"f421b75b009fe55f","repo":"jdx/mise","slug":"homebrew-now-owns-this-cask-f421b7","errorCode":null,"errorMessage":"Homebrew now owns this cask","messagePattern":"Homebrew now owns this cask","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/packages/brew/cask/state.rs","lineNumber":1032,"sourceCode":"        }\n    }\n    for target in &candidate.receipt.targets {\n        if claims\n            .get(&target.path)\n            .is_some_and(|tokens| tokens.iter().any(|token| token != &candidate.token))\n        {\n            bail!(\n                \"artifact target is now claimed by another cask: {}\",\n                target.path.display()\n            );\n        }\n    }\n    Ok(())\n}\n\npub(super) fn validate_cask_prune_candidate(candidate: &CaskPruneCandidate) -> Result<()> {\n    if homebrew_metadata_present(&candidate.token)? {\n        bail!(\"Homebrew now owns this cask\");\n    }\n    let receipt = &candidate.receipt;\n    if read_receipt(&candidate.version_dir)?.as_ref() != Some(receipt) {\n        bail!(\"ownership receipt has changed\");\n    }\n    if receipt.schema_version != 3 || !receipt.prune_safe || !receipt.pkg_ids.is_empty() {\n        bail!(\"receipt is not marked safe for direct-artifact pruning\");\n    }\n    if !receipt.metadata_only_apps.is_empty() {\n        bail!(\"metadata-only app ownership cannot be proven safely during pruning\");\n    }\n    let records = receipt\n        .targets\n        .iter()\n        .map(|record| (record.path.clone(), record))\n        .collect::<BTreeMap<_, _>>();\n    let expected = receipt.standard_targets().cloned().collect::<BTreeSet<_>>();\n    if expected.is_empty()","sourceCodeStart":1014,"sourceCodeEnd":1050,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/system/packages/brew/cask/state.rs#L1014-L1050","documentation":"validate_cask_prune_candidate verifies a mise-owned cask is still safe to prune directly. First check: if Homebrew metadata for the token is now present, Homebrew has taken ownership and mise must not delete artifacts itself, so it bails with this short message. This is a safety precondition for direct-artifact pruning.","triggerScenarios":"cask_prune_plan_from_tokens or apply_cask_prune_plan_in calls validate_cask_prune_candidate and homebrew_metadata_present(&candidate.token) returns true — Homebrew (re)installed the cask after mise's receipt was written.","commonSituations":"User ran `brew install --cask` on a token mise previously managed; brew autoupdate adopted the cask; cask migrated from mise ownership to Homebrew between operations.","solutions":["Let Homebrew manage it now: use `brew uninstall --cask <token>` if removal is the goal","Use Homebrew-driven workflows for this cask going forward instead of mise direct-artifact pruning","If mise should own it again, remove Homebrew's metadata/instance and reinstall through mise"],"exampleFix":"// before: pruning a cask that brew now owns\nmise cask prune <token>   # \"Homebrew now owns this cask\"\n// after\nbrew uninstall --cask <token>","handlingStrategy":"validation","validationCode":"// before pruning, confirm mise still owns the token\nbrew info --cask <token> >/dev/null 2>&1 && echo \"brew owns it; use brew uninstall\" || echo \"safe to prune via mise\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pick one owner per cask: either Homebrew or mise, not both","Check `brew info --cask <token>` before mise prune operations","Disable Homebrew autoupdate for tokens managed by mise"],"tags":["homebrew","cask","ownership","prune"],"backgroundTag":"invalid-state-transition","analyzedSha":"afd2eddd3a50c16190efc1c7e94404b48f72af57","analyzedAt":"2026-09-09T01:38:25.179Z","contentChangedAt":"2026-09-09T01:38:25.179Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}