{"record":{"id":"666704c5f4086763","repo":"jdx/mise","slug":"brew-cask-pkg-artifacts-require-pkgutil-ids-in","errorCode":null,"errorMessage":"brew-cask:{}: pkg artifacts require pkgutil ids in uninstall metadata","messagePattern":"brew-cask:(.+?): pkg artifacts require pkgutil ids in uninstall metadata","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/packages/brew/cask.rs","lineNumber":5022,"sourceCode":"        && artifacts.command_wrappers.is_empty()\n        && artifacts.pkgs.is_empty()\n        && artifacts.installers.is_empty()\n        && artifacts.generic.is_empty()\n        && artifacts.fonts.is_empty()\n        && artifacts.completions.is_empty()\n        && artifacts.generated_completions.is_empty()\n    {\n        bail!(\n            \"brew-cask:{}: no supported install artifact found\",\n            cask.token\n        );\n    }\n    artifacts.pkg_ids.sort();\n    artifacts.pkg_ids.dedup();\n    if artifacts.pkgs.is_empty() {\n        artifacts.pkg_ids.clear();\n    } else if artifacts.pkg_ids.is_empty() {\n        bail!(\n            \"brew-cask:{}: pkg artifacts require pkgutil ids in uninstall metadata\",\n            cask.token\n        );\n    }\n    Ok(artifacts)\n}\n\nfn validate_platform_support(cask: &Cask, artifacts: &CaskArtifacts) -> Result<()> {\n    #[cfg(target_os = \"linux\")]\n    {\n        let font_only = !artifacts.fonts.is_empty()\n            && artifacts.apps.is_empty()\n            && artifacts.binaries.is_empty()\n            && artifacts.command_wrappers.is_empty()\n            && artifacts.pkgs.is_empty()\n            && artifacts.installers.is_empty()\n            && artifacts.generic.is_empty()\n            && artifacts.completions.is_empty()","sourceCodeStart":5004,"sourceCodeEnd":5040,"githubUrl":"https://github.com/jdx/mise/blob/6f52dcdf99e282ef7a7db68c81301fa4618d0f79/src/system/packages/brew/cask.rs#L5004-L5040","documentation":"mise uses macOS pkgutil receipts to know which packages a cask's pkg artifacts installed, so it can uninstall and track them. After collecting artifacts it requires: if any 'pkg' artifacts exist, the cask's uninstall metadata must declare at least one pkgutil id. When pkgs are present but the pkgutil list is empty, install aborts — otherwise mise would install a pkg it could never cleanly uninstall.","triggerScenarios":"Cask metadata with `artifacts: [{pkg: ...}]` but no `uninstall: {pkgutil: [...]}` receipts (see the branch at src/system/packages/brew/cask.rs:5022). Typical of hand-written metadata, converted casks, or upstream casks that rely on other receipt kinds (launchservices, quit scripts) without pkgutil entries.","commonSituations":"Authoring a custom cask JSON for an internal .pkg and forgetting receipts; upstream casks whose uninstall uses only `delete`/`launchctl` stanzas; schema drift where the pkgutil field was renamed.","solutions":["If you author the cask: install the pkg once manually, run `pkgutil --pkgs | grep -i <name>` to find the receipt id, and add it under uninstall.pkgutil.","If the metadata is third-party, report the missing receipts upstream.","As an end user, install that cask with real Homebrew (brew handles receipts differently) instead of mise.","Verify with the API JSON that uninstall.pkgutil truly is absent before assuming a mise bug."],"exampleFix":"# before\nartifacts: [{ pkg: \"Installer.pkg\" }]\nuninstall: {}\n\n# after\nartifacts: [{ pkg: \"Installer.pkg\" }]\nuninstall: { pkgutil: [\"com.example.mytool\"] }","handlingStrategy":"validation","validationCode":"# custom casks with pkg artifacts must carry pkgutil receipts\njq -e 'select(([.artifacts[]? | keys[]?] | any(. == \"pkg\")) | not or ([.uninstall.pkgutil // []] | flatten | length) > 0)' cask.json >/dev/null || echo 'missing uninstall.pkgutil'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["After authoring a pkg cask, install once and harvest receipts via `pkgutil --pkgs`.","Make pkgutil receipts a required field in your cask metadata schema.","Validate custom metadata with jq before committing it."],"tags":["brew-cask","pkg","uninstall-metadata","macos","mise"],"backgroundTag":"missing-uninstall-metadata","analyzedSha":"6f52dcdf99e282ef7a7db68c81301fa4618d0f79","analyzedAt":"2026-08-22T10:14:23.840Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}