{"record":{"id":"8740750a2b33d545","repo":"jdx/mise","slug":"brew-name-the-homebrew-cask-namespace-is-unsupported-for","errorCode":null,"errorMessage":"brew:{name}: the Homebrew cask namespace is unsupported for formula lookup","messagePattern":"brew:(.+?): the Homebrew cask namespace is unsupported for formula lookup","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/packages/brew/mod.rs","lineNumber":70,"sourceCode":"/// Resolve a canonical formula name or owner/tap/name to its installed opt path using local records.\n/// Qualified names identify the rack by their final component; aliases and tap provenance are not resolved.\npub(crate) fn package_root(name: &str) -> Result<PathBuf> {\n    let parts = name.split('/').collect::<Vec<_>>();\n    if !matches!(parts.len(), 1 | 3)\n        || parts.iter().any(|part| {\n            part.is_empty()\n                || part\n                    .chars()\n                    .any(|c| c.is_whitespace() || c.is_control() || matches!(c, ':' | '\\\\'))\n                || !is_normal_formula_component(part)\n        })\n    {\n        bail!(\n            \"invalid brew formula {name:?}; use brew:<formula> or brew:<owner>/<tap>/<formula> with normal, nonempty path components\"\n        );\n    }\n    if parts.len() == 3 && parts[0] == \"homebrew\" && parts[1] == \"cask\" {\n        bail!(\"brew:{name}: the Homebrew cask namespace is unsupported for formula lookup\");\n    }\n    let formula = request_formula_name(name);\n    assert!(\n        is_normal_formula_component(formula),\n        \"validated formula must normalize to exactly one normal path component\"\n    );\n    pour::strict_package_root(formula)\n        .wrap_err_with(|| format!(\"failed to locate installed brew:{name}\"))\n}\n\n/// Require one normal path component so a formula name stays within its expected rack.\nfn is_normal_formula_component(name: &str) -> bool {\n    let mut components = Path::new(name).components();\n    matches!(components.next(), Some(Component::Normal(_))) && components.next().is_none()\n}\n\nimpl BrewManager {\n    pub(crate) fn new() -> Self {","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/packages/brew/mod.rs#L52-L88","documentation":"The Homebrew cask namespace (GUI app packages) is not supported for formula lookup — the brew backend only resolves formulae, not casks. When a name resolves to homebrew/cask/<formula>, the lookup is rejected with this message instead of returning wrong results.","triggerScenarios":"package_root detects parts == [\"homebrew\", \"cask\", <name>] and bails. Triggered by specs like brew:homebrew/cask/firefox or explicitly targeting the cask namespace in a brew tool entry.","commonSituations":"Users trying to install GUI apps (Firefox, iTerm, etc.) via the brew backend; migrating a Brewfile that contains casks into tool configuration.","solutions":["Install casks with Homebrew directly (`brew install --cask <name>`).","Use a supported backend for the equivalent CLI tool if one exists.","For CLI tools distributed only via casks, look for a formula or alternative source (npm, github backend).","Remove cask entries from brew tool configuration."],"exampleFix":"// before\n\"brew:homebrew/cask/firefox\" = \"latest\"  // unsupported\n// after\n// install GUI apps via Homebrew itself: brew install --cask firefox\n\"brew:wget\" = \"latest\"  // CLI tools only via brew backend","handlingStrategy":"fallback","validationCode":"fn is_cask_spec(parts: &[&str]) -> bool {\n    parts.len() == 3 && parts[0] == \"homebrew\" && parts[1] == \"cask\"\n}","typeGuard":null,"tryCatchPattern":"match install(spec) {\n    Err(e) if e.to_string().contains(\"cask namespace is unsupported\") => {\n        let name = spec.rsplit('/').next().unwrap();\n        let _ = Command::new(\"brew\").args([\"install\", \"--cask\", name]).status();\n    }\n    other => other,\n}","preventionTips":["Audit tool lists for homebrew/cask entries before applying config.","Install GUI apps with `brew install --cask` directly instead.","Map cask-only software to alternative backends (npm, github, aqua).","Document in team configs that the brew backend covers formulae only."],"tags":["brew","cask","unsupported-operation"],"backgroundTag":"unsupported-operation","analyzedSha":"533346cc374382b41ec5ff70536252b2e96e725c","analyzedAt":"2026-09-17T13:35:38.149Z","contentChangedAt":"2026-09-17T13:35:38.149Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}