jdx/mise · error

brew-cask:{}: unsupported {kind} {field} base {}

Error message

brew-cask:{}: unsupported {kind} {field} base {}

What it means

When resolving a contextual cask path (e.g. an if_exists/unless_exists run-guard path), the optional `base` key selects the root the path is relative to. Supported values are `staged_path`, `appdir`, `homebrew_prefix`, and `relative` (or omitted). Any other `base` string triggers this error.

Source

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

    }
}

pub(super) fn parse_context_flight_path(
    cask: &Cask,
    kind: &str,
    field: &str,
    object: &serde_json::Map<String, Value>,
) -> Result<FlightPath> {
    let path = object
        .get("path")
        .and_then(Value::as_str)
        .ok_or_else(|| eyre!("brew-cask:{}: unsupported {kind} {field} path", cask.token))?;
    let base = match object.get("base").and_then(Value::as_str) {
        Some("staged_path") => FlightPathBase::StagedPath,
        Some("appdir") => FlightPathBase::AppDir,
        Some("homebrew_prefix") => FlightPathBase::HomebrewPrefix,
        Some("relative") => FlightPathBase::Literal,
        Some(base) => bail!(
            "brew-cask:{}: unsupported {kind} {field} base {}",
            cask.token,
            base
        ),
        None => FlightPathBase::Literal,
    };
    Ok(FlightPath {
        base,
        path: path.to_string(),
    })
}

pub(super) fn parse_context_flight_path_value(
    cask: &Cask,
    kind: &str,
    field: &str,
    value: Option<&Value>,
) -> Result<FlightPath> {

View on GitHub (pinned to afd2eddd3a)

Solutions

  1. Change `base` to one of: "staged_path", "appdir", "homebrew_prefix", or "relative".
  2. Remove `base` entirely to use the default (literal/relative) interpretation.
  3. Fix casing/typo issues (values are lowercase with underscores, e.g. `homebrew_prefix`).
  4. If the cask needs an unmapped Homebrew base, remove the guarded artifact or request support upstream.

Example fix

// before
{ "condition": "if_exists", "base": "app", "path": "Foo.app" }
// after
{ "condition": "if_exists", "base": "appdir", "path": "Foo.app" }
Defensive patterns

Strategy: validation

Validate before calling

const BASES = new Set(["staged_path", "appdir", "homebrew_prefix", "relative"]);
function hasSupportedBase(pathObj) {
  return pathObj?.base === undefined || BASES.has(pathObj.base);
}

Type guard

function hasKnownBase(p: { base?: string }): p is { base: "staged_path" | "appdir" | "homebrew_prefix" | "relative" } {
  return p.base === undefined || ["staged_path","appdir","homebrew_prefix","relative"].includes(p.base);
}

Try / catch

try {
  installCask(token);
} catch (e) {
  if (String(e).includes("base")) {
    console.warn(`Cask ${token} uses an unsupported path base; skipping`);
  } else throw e;
}

Prevention

When it happens

Trigger: A cask stanza's contextual path object contains {"base":"<unknown>","path":"..."} with a base like `app`, `HOMEBREW_PREFIX`, `caskroom`, or another value outside the four supported ones.

Common situations: Casks authored against Homebrew DSL bases this tool doesn't map, typos such as "staged path" or "staged_path " (whitespace/case), and custom-tap casks using esoteric base names.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


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