jdx/mise · error

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

Error message

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

What it means

Sibling of the platform-value error: the guard declares "condition": "on" but the "value" key is missing or is not a string (as_str returns None), so there is no platform to test and the guard is rejected. Note the message intentionally omits the trailing value placeholder.

Source

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

        )
    })?;
    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!(
            "brew-cask:{}: unsupported {kind} run guard condition {}",
            cask.token,
            condition
        ),
        None => bail!(

View on GitHub (pinned to 6f52dcdf99)

Solutions

  1. Add the platform string: {"condition": "on", "value": "macos"} or "linux"
  2. If you meant an existence check, use condition if_exists/unless_exists with base/path instead

Example fix

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

Strategy: validation

Validate before calling

fn guard_on_has_value(g: &serde_json::Value) -> bool {
    if g.get("condition").and_then(|c| c.as_str()) == Some("on") {
        return g.get("value").and_then(|v| v.as_str()).is_some();
    }
    true
}

Try / catch

match parse_flight_guard(&cask, kind, &guard) {
    Ok(g) => { /* proceed */ }
    Err(e) if e.to_string().contains("run guard platform") => {
        eprintln!("a 'condition: on' guard also needs a string 'value' (macos/linux)");
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: {"condition": "on"} with no value key, or "value": 1 / {"os": "macos"} — anything where value.as_str() is None.

Common situations: Truncated guard objects from templating; assuming "on" alone means 'on macOS'; placing the platform in a differently named key ("platform", "os").

Related errors


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