{"record":{"id":"9a85856208a545ef","repo":"jdx/mise","slug":"brew-cask-pkg-installer-choices-are-not-supported","errorCode":null,"errorMessage":"brew-cask: pkg installer choices are not supported yet","messagePattern":"brew-cask: pkg installer choices are not supported yet","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/packages/brew/cask.rs","lineNumber":5219,"sourceCode":"        target: artifact_target(value, values),\n        content,\n        executable,\n        args,\n        env,\n    }))\n}\n\nfn parse_pkg_artifact(value: &Value) -> Result<Option<PkgArtifact>> {\n    let Some(pkg) = value.as_object().and_then(|o| o.get(\"pkg\")) else {\n        return Ok(None);\n    };\n    match pkg {\n        Value::String(source) => Ok(Some(PkgArtifact {\n            source: source.clone(),\n        })),\n        Value::Array(values) => {\n            if values.len() > 1 {\n                bail!(\"brew-cask: pkg installer choices are not supported yet\");\n            }\n            Ok(values\n                .first()\n                .and_then(Value::as_str)\n                .map(|source| PkgArtifact {\n                    source: source.to_string(),\n                }))\n        }\n        _ => Ok(None),\n    }\n}\n\nfn parse_installer_artifact(value: &Value) -> Result<Option<InstallerArtifact>> {\n    let Some(installer) = value.as_object().and_then(|object| object.get(\"installer\")) else {\n        return Ok(None);\n    };\n    let values = installer\n        .as_array()","sourceCodeStart":5201,"sourceCodeEnd":5237,"githubUrl":"https://github.com/jdx/mise/blob/6f52dcdf99e282ef7a7db68c81301fa4618d0f79/src/system/packages/brew/cask.rs#L5201-L5237","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Reduce the pkg stanza to a single string: {\"pkg\": \"a.pkg\"}","If multiple pkgs are genuinely required, split them into separate installer stanzas or install the extra pkgs outside mise","File an upstream issue with mise (include the cask token) if a real Homebrew cask needs multi-pkg support"],"exampleFix":"// before\n{\"artifact\": {\"pkg\": [\"Installer.pkg\", \"Extras.pkg\"]}}\n// after\n{\"artifact\": {\"pkg\": \"Installer.pkg\"}}","handlingStrategy":"validation","validationCode":"fn pkg_artifact_ok(v: &serde_json::Value) -> bool {\n    match v.get(\"pkg\") {\n        Some(serde_json::Value::String(_)) => true,\n        Some(serde_json::Value::Array(a)) => a.len() <= 1,\n        _ => true,\n    }\n}","typeGuard":"fn is_supported_pkg(v: &serde_json::Value) -> bool {\n    matches!(v, serde_json::Value::String(_))\n        || matches!(v, serde_json::Value::Array(a) if a.len() == 1 && a[0].is_string())\n}","tryCatchPattern":"match parse_pkg_artifact(&artifact) {\n    Ok(pkg) => { /* proceed */ }\n    Err(e) if e.to_string().contains(\"pkg installer choices\") => {\n        eprintln!(\"multiple pkg installers are unsupported; split into separate installer stanzas\");\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Write pkg as a single string, matching Homebrew's own DSL","Never emit multi-element pkg arrays from cask generators","Audit custom casks for array-valued pkg stanzas before installing with mise"],"tags":["brew-cask","mise","pkg-installer","config-validation","unsupported-feature"],"backgroundTag":"brew-cask-stanza-validation","analyzedSha":"6f52dcdf99e282ef7a7db68c81301fa4618d0f79","analyzedAt":"2026-08-22T10:14:23.840Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}