jdx/mise · error

brew: : the Homebrew cask namespace is unsupported for…

Error message

brew:{name}: the Homebrew cask namespace is unsupported for formula lookup

What it means

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.

Solutions

  1. Install casks with Homebrew directly (`brew install --cask <name>`).
  2. Use a supported backend for the equivalent CLI tool if one exists.
  3. For CLI tools distributed only via casks, look for a formula or alternative source (npm, github backend).
  4. Remove cask entries from brew tool configuration.

Example fix

// before
"brew:homebrew/cask/firefox" = "latest"  // unsupported
// after
// install GUI apps via Homebrew itself: brew install --cask firefox
"brew:wget" = "latest"  // CLI tools only via brew backend
Defensive patterns

Strategy: fallback

Validate before calling

fn is_cask_spec(parts: &[&str]) -> bool {
    parts.len() == 3 && parts[0] == "homebrew" && parts[1] == "cask"
}

Try / catch

match install(spec) {
    Err(e) if e.to_string().contains("cask namespace is unsupported") => {
        let name = spec.rsplit('/').next().unwrap();
        let _ = Command::new("brew").args(["install", "--cask", name]).status();
    }
    other => other,
}

Prevention

When it happens

Trigger: 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.

Common situations: Users trying to install GUI apps (Firefox, iTerm, etc.) via the brew backend; migrating a Brewfile that contains casks into tool configuration.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17). Data as JSON: /api/errors/8740750a2b33d545. Report an issue: GitHub.

Appendix: source

Thrown at src/system/packages/brew/mod.rs:70

/// Resolve a canonical formula name or owner/tap/name to its installed opt path using local records.
/// Qualified names identify the rack by their final component; aliases and tap provenance are not resolved.
pub(crate) fn package_root(name: &str) -> Result<PathBuf> {
    let parts = name.split('/').collect::<Vec<_>>();
    if !matches!(parts.len(), 1 | 3)
        || parts.iter().any(|part| {
            part.is_empty()
                || part
                    .chars()
                    .any(|c| c.is_whitespace() || c.is_control() || matches!(c, ':' | '\\'))
                || !is_normal_formula_component(part)
        })
    {
        bail!(
            "invalid brew formula {name:?}; use brew:<formula> or brew:<owner>/<tap>/<formula> with normal, nonempty path components"
        );
    }
    if parts.len() == 3 && parts[0] == "homebrew" && parts[1] == "cask" {
        bail!("brew:{name}: the Homebrew cask namespace is unsupported for formula lookup");
    }
    let formula = request_formula_name(name);
    assert!(
        is_normal_formula_component(formula),
        "validated formula must normalize to exactly one normal path component"
    );
    pour::strict_package_root(formula)
        .wrap_err_with(|| format!("failed to locate installed brew:{name}"))
}

/// Require one normal path component so a formula name stays within its expected rack.
fn is_normal_formula_component(name: &str) -> bool {
    let mut components = Path::new(name).components();
    matches!(components.next(), Some(Component::Normal(_))) && components.next().is_none()
}

impl BrewManager {
    pub(crate) fn new() -> Self {

View on GitHub (pinned to 533346cc37)