jdx/mise · error

brew-cask:{}: pkg artifacts require pkgutil ids in uninstall

Error message

brew-cask:{}: pkg artifacts require pkgutil ids in uninstall metadata

What it means

When a cask contains `pkg` artifacts, the uninstall section of the cask must list `pkgutil:` IDs so the package can later be uninstalled via pkgutil. cask_artifacts collects these pkg_ids and bails if a cask has pkg artifacts but the uninstall metadata supplied none, because installing such a cask would leave it unremovable.

Source

Thrown at src/system/packages/brew/cask/artifacts.rs:81

        && artifacts.command_wrappers.is_empty()
        && artifacts.pkgs.is_empty()
        && artifacts.installers.is_empty()
        && artifacts.generic.is_empty()
        && artifacts.fonts.is_empty()
        && artifacts.completions.is_empty()
        && artifacts.generated_completions.is_empty()
    {
        bail!(
            "brew-cask:{}: no supported install artifact found",
            cask.token
        );
    }
    artifacts.pkg_ids.sort();
    artifacts.pkg_ids.dedup();
    if artifacts.pkgs.is_empty() {
        artifacts.pkg_ids.clear();
    } else if artifacts.pkg_ids.is_empty() {
        bail!(
            "brew-cask:{}: pkg artifacts require pkgutil ids in uninstall metadata",
            cask.token
        );
    }
    Ok(artifacts)
}

pub(super) fn validate_platform_support(cask: &Cask, artifacts: &CaskArtifacts) -> Result<()> {
    #[cfg(target_os = "linux")]
    {
        let font_only = !artifacts.fonts.is_empty()
            && artifacts.apps.is_empty()
            && artifacts.binaries.is_empty()
            && artifacts.command_wrappers.is_empty()
            && artifacts.pkgs.is_empty()
            && artifacts.installers.is_empty()
            && artifacts.generic.is_empty()
            && artifacts.completions.is_empty()

View on GitHub (pinned to afd2eddd3a)

Solutions

  1. Open the cask (brew cat --cask <token>) and check that the uninstall block contains `pkgutil: "com.vendor.package.id"` entries.
  2. Fix the cask by adding pkgutil IDs under uninstall (find them after installing with `pkgutil --pkgs` or from the receipt inside the pkg).
  3. If you control the tap, add e.g. `uninstall pkgutil: "com.example.mytool"` to the cask and commit.
  4. As a workaround, install the underlying pkg directly (`brew install --cask` upstream or `installer -pkg`) and manage removal yourself.

Example fix

// before: pkg without pkgutil ids in uninstall
pkg "MyTool.pkg"
uninstall delete: "/Applications/MyTool.app"
// after
pkg "MyTool.pkg"
uninstall pkgutil: "com.example.mytool",
         delete: "/Applications/MyTool.app"
Defensive patterns

Strategy: validation

Validate before calling

const pkgArtifacts = info.artifacts.filter(a => "pkg" in a);
const hasPkgutil = JSON.stringify(info.artifacts).includes("pkgutil");
if (pkgArtifacts.length > 0 && !hasPkgutil)
  throw new Error(`${token}: pkg cask missing uninstall pkgutil ids`);

Try / catch

match cask_artifacts(&cask) {
    Err(e) if e.to_string().contains("require pkgutil ids") => {
        eprintln!("{}: add `uninstall pkgutil:` to the cask before installing", cask.token);
    }
    other => other?,
}

Prevention

When it happens

Trigger: Installing (install_one_with_ancestors) or computing package_state for a cask with `pkg "Foo.pkg"` stanzas whose `uninstall` block lacks `pkgutil:` entries (or has an empty list), producing zero collected pkg_ids.

Common situations: Hand-written or malformed casks missing the `uninstall pkgutil:` stanza; casks where the pkgutil ids live in a section this parser doesn't read; custom taps written for plain brew (which tolerates the omission) being consumed by this stricter implementation.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


AI-assisted analysis of jdx/mise@afd2eddd3a (2026-09-09). Data as JSON: /api/errors/8a3f59c1cd8fd5c0. Report an issue: GitHub.