jdx/mise · error

brew-cask:{}: unsupported {kind} run guard platform {}

Error message

brew-cask:{}: unsupported {kind} run guard platform {}

What it means

Thrown while parsing a run/copy guard with condition "on". Platform guards accept only "macos" and "linux" as the value; any other string ("windows", "unix", "arm64") is unsupported and bails with the value echoed.

Source

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

fn parse_flight_guard(cask: &Cask, kind: &str, value: &Value) -> Result<FlightGuard> {
    let object = value.as_object().ok_or_else(|| {
        eyre!(
            "brew-cask:{}: unsupported {kind} run guard metadata format",
            cask.token
        )
    })?;
    reject_unsupported_flight_fields(
        cask,
        kind,
        "run guard",
        object,
        &["condition", "value", "base", "path", "id"],
    )?;
    match object.get("condition").and_then(Value::as_str) {
        Some("on") => match object.get("value").and_then(Value::as_str) {
            Some("macos") => Ok(FlightGuard::OnMacos),
            Some("linux") => Ok(FlightGuard::OnLinux),
            Some(value) => bail!(
                "brew-cask:{}: unsupported {kind} run guard platform {}",
                cask.token,
                value
            ),
            None => bail!(
                "brew-cask:{}: unsupported {kind} run guard platform",
                cask.token
            ),
        },
        Some(condition @ ("if_exists" | "unless_exists")) => {
            let path = parse_context_flight_path(cask, kind, "run guard", object)?;
            if condition == "if_exists" {
                Ok(FlightGuard::IfExists(path))
            } else {
                Ok(FlightGuard::UnlessExists(path))
            }
        }
        Some(condition) => bail!(

View on GitHub (pinned to 6f52dcdf99)

Solutions

  1. Use "value": "macos" or "value": "linux" with "condition": "on"
  2. For existence checks, switch to "condition": "if_exists" / "unless_exists" with a path instead

Example fix

// before
{"condition": "on", "value": "darwin"}
// after
{"condition": "on", "value": "macos"}
Defensive patterns

Strategy: validation

Validate before calling

fn guard_ok(g: &serde_json::Value) -> bool {
    if g.get("condition").and_then(|c| c.as_str()) == Some("on") {
        return matches!(g.get("value").and_then(|v| v.as_str()), Some("macos") | Some("linux"));
    }
    true
}

Type guard

fn is_supported_platform(v: &serde_json::Value) -> bool {
    matches!(v.as_str(), Some("macos") | Some("linux"))
}

Try / catch

match parse_flight_guard(&cask, kind, &guard) {
    Ok(g) => { /* proceed */ }
    Err(e) if e.to_string().contains("run guard platform") => {
        eprintln!("platform guards accept only 'macos' or 'linux'");
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: {"guards": [{"condition": "on", "value": "windows"}]} on a copy step, or {"condition": "on", "value": "darwin"} on a run step — macos/linux are the only recognized platform tokens.

Common situations: Using uname vocabulary (darwin/linux) instead of macos; attempting architecture guards via the platform slot; copying condition vocabulary from Homebrew's depends_on stanza.

Related errors


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