jdx/mise · error

brew-cask: pkg installer choices are not supported yet

Error message

brew-cask: pkg installer choices are not supported yet

What it means

Thrown by parse_pkg_artifact. mise supports a cask 'pkg' artifact as a single string (the normal Homebrew DSL) and additionally tolerates a one-element array, but a pkg array with more than one entry would imply multiple installer pkgs or installer choices, which the installer flow cannot execute, so it bails instead of silently installing only part of the set.

Source

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

        target: artifact_target(value, values),
        content,
        executable,
        args,
        env,
    }))
}

fn parse_pkg_artifact(value: &Value) -> Result<Option<PkgArtifact>> {
    let Some(pkg) = value.as_object().and_then(|o| o.get("pkg")) else {
        return Ok(None);
    };
    match pkg {
        Value::String(source) => Ok(Some(PkgArtifact {
            source: source.clone(),
        })),
        Value::Array(values) => {
            if values.len() > 1 {
                bail!("brew-cask: pkg installer choices are not supported yet");
            }
            Ok(values
                .first()
                .and_then(Value::as_str)
                .map(|source| PkgArtifact {
                    source: source.to_string(),
                }))
        }
        _ => Ok(None),
    }
}

fn parse_installer_artifact(value: &Value) -> Result<Option<InstallerArtifact>> {
    let Some(installer) = value.as_object().and_then(|object| object.get("installer")) else {
        return Ok(None);
    };
    let values = installer
        .as_array()

View on GitHub (pinned to 6f52dcdf99)

Solutions

  1. Reduce the pkg stanza to a single string: {"pkg": "a.pkg"}
  2. If multiple pkgs are genuinely required, split them into separate installer stanzas or install the extra pkgs outside mise
  3. File an upstream issue with mise (include the cask token) if a real Homebrew cask needs multi-pkg support

Example fix

// before
{"artifact": {"pkg": ["Installer.pkg", "Extras.pkg"]}}
// after
{"artifact": {"pkg": "Installer.pkg"}}
Defensive patterns

Strategy: validation

Validate before calling

fn pkg_artifact_ok(v: &serde_json::Value) -> bool {
    match v.get("pkg") {
        Some(serde_json::Value::String(_)) => true,
        Some(serde_json::Value::Array(a)) => a.len() <= 1,
        _ => true,
    }
}

Type guard

fn is_supported_pkg(v: &serde_json::Value) -> bool {
    matches!(v, serde_json::Value::String(_))
        || matches!(v, serde_json::Value::Array(a) if a.len() == 1 && a[0].is_string())
}

Try / catch

match parse_pkg_artifact(&artifact) {
    Ok(pkg) => { /* proceed */ }
    Err(e) if e.to_string().contains("pkg installer choices") => {
        eprintln!("multiple pkg installers are unsupported; split into separate installer stanzas");
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: An artifact object whose "pkg" key is an array with length > 1, e.g. {"artifact": {"pkg": ["a.pkg", "b.pkg"]}}, processed while mise parses cask artifacts for install/uninstall.

Common situations: Custom cask JSON listing several .pkg installers under one stanza; tooling that always emits arrays instead of scalar strings; Homebrew casks that use uncommon multi-pkg layouts.

Related errors


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