jdx/mise · error

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

Error message

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

What it means

A run guard with `condition = "on"` restricts a step to a platform, and only "macos" and "linux" are accepted as the `value`. Any other platform string triggers this bail; a missing value has its own separate message.

Source

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

pub(super) 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 afd2eddd3a)

Solutions

  1. Change the value to exactly "macos" or "linux".
  2. Remove the guard if the step should run on all platforms.
  3. Fix casing — the accepted values are lowercase.

Example fix

// before
[[install.flight_steps]]
type = "run"
command = { base = "staged_path", path = "bin/setup" }
guards = [{ condition = "on", value = "darwin" }]
// after
[[install.flight_steps]]
type = "run"
command = { base = "staged_path", path = "bin/setup" }
guards = [{ condition = "on", value = "macos" }]
Defensive patterns

Strategy: validation

Validate before calling

const PLATFORMS = new Set(['macos', 'linux']);
function validateGuards(step) {
  for (const g of step.guards ?? []) {
    if (g.condition === 'on' && !PLATFORMS.has(g.value)) {
      throw new Error(`unsupported run guard platform: ${g.value}`);
    }
  }
}

Type guard

const isValidPlatformGuard = (g) => g.condition !== 'on' || PLATFORMS.has(g.value);

Prevention

When it happens

Trigger: A cask defines a run guard like `condition = "on"`, `value = "windows"` or `value = "darwin"`; parse_flight_guard's inner `Some(value)` arm fires for unrecognized platform names.

Common situations: Using Homebrew/Ruby symbols like :mac or :darwin instead of mise's "macos"; expecting windows support in a mac/linux-only cask system; typos like "MacOS" (case-sensitive).

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/84fd41ff2528c48a. Report an issue: GitHub.