jdx/mise · error

brew-cask:{}: unsupported {kind} run command base {}

Error message

brew-cask:{}: unsupported {kind} run command base {}

What it means

Thrown while parsing a run step's command path base. The optional 'base' says where the relative path is anchored: "staged_path" (cask extract dir), "appdir" (/Applications), "homebrew_prefix"; when absent the path is taken literally. Any other base string is rejected.

Source

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

fn parse_run_command(cask: &Cask, kind: &str, value: Option<&Value>) -> Result<FlightPath> {
    let object = value.and_then(Value::as_object).ok_or_else(|| {
        eyre!(
            "brew-cask:{}: unsupported {kind} run command metadata format",
            cask.token
        )
    })?;
    reject_unsupported_flight_fields(cask, kind, "run command", object, &["base", "path"])?;
    let path = object.get("path").and_then(Value::as_str).ok_or_else(|| {
        eyre!(
            "brew-cask:{}: unsupported {kind} run command 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(base) => bail!(
            "brew-cask:{}: unsupported {kind} run command base {}",
            cask.token,
            base
        ),
        None => FlightPathBase::Literal,
    };
    let path_value = Path::new(path);
    let invalid_absolute_path = base == FlightPathBase::Literal
        && !path_value.is_absolute()
        && path_value.components().count() > 1;
    let invalid_based_path = matches!(
        base,
        FlightPathBase::StagedPath | FlightPathBase::AppDir | FlightPathBase::HomebrewPrefix
    ) && (path_value.is_absolute()
        || path_value
            .components()
            .any(|component| matches!(component, Component::ParentDir)));
    if invalid_absolute_path || invalid_based_path {

View on GitHub (pinned to 6f52dcdf99)

Solutions

  1. Use one of the supported bases: "staged_path", "appdir", "homebrew_prefix"
  2. Or omit "base" and give an absolute literal path

Example fix

// before
{"path": "Contents/MacOS/install.sh", "base": "app_dir"}
// after
{"path": "Contents/MacOS/install.sh", "base": "appdir"}
Defensive patterns

Strategy: validation

Validate before calling

fn run_base_ok(cmd: &serde_json::Value) -> bool {
    match cmd.get("base") {
        None => true,
        Some(serde_json::Value::String(s)) => matches!(s.as_str(), "staged_path" | "appdir" | "homebrew_prefix"),
        Some(_) => false,
    }
}

Type guard

fn is_supported_run_base(v: &serde_json::Value) -> bool {
    v.as_str().map(|s| ["staged_path", "appdir", "homebrew_prefix"].contains(&s)).unwrap_or(false)
}

Try / catch

match parse_run_command(&cask, kind, Some(&cmd)) {
    Ok(path) => { /* proceed */ }
    Err(e) if e.to_string().contains("run command base") => {
        eprintln!("base must be staged_path, appdir, or homebrew_prefix (or omitted)");
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: A run command object {"path": "helper.sh", "base": "tmpdir"} — values like "root", "home", "caskroom", or misspellings like "stagedpath" all bail with the base echoed in the message.

Common situations: Guessing base names instead of checking the enum; Homebrew DSL drift (e.g. expecting :homebrew_caskroom); renaming between versions of the metadata format.

Related errors


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