jdx/mise · error

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

Error message

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

What it means

Thrown by parse_context_flight_path, the path resolver shared by run guards and copy source/target fields (the field name is interpolated, e.g. 'run guard path', 'copy source'). Unlike run-command bases, this resolver also accepts "relative" (mapped to Literal). Accepted bases: staged_path, appdir, homebrew_prefix, relative; absent means literal. Any other base string bails.

Source

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

    }
}

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(),
    })
}

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

View on GitHub (pinned to 6f52dcdf99)

Solutions

  1. Use "staged_path", "appdir", "homebrew_prefix", or "relative"
  2. Omit "base" when the path is a literal/absolute path

Example fix

// before
{"condition": "if_exists", "path": "marker", "base": "stage"}
// after
{"condition": "if_exists", "path": "marker", "base": "staged_path"}
Defensive patterns

Strategy: validation

Validate before calling

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

Type guard

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

Try / catch

match parse_context_flight_path(&cask, kind, field, object) {
    Ok(p) => { /* proceed */ }
    Err(e) if e.to_string().contains("base") => {
        eprintln!("guard/copy bases: staged_path, appdir, homebrew_prefix, relative (or omit)");
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: {"condition": "if_exists", "path": "x", "base": "home"} in a guard, or a copy step source {"path": "data", "base": "caskroom"} — any base token outside the four accepted values.

Common situations: Assuming run-command and guard bases share vocabularies when they differ slightly; guessing base names; metadata produced for a different mise version.

Related errors


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