jdx/mise · error

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

Error message

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

What it means

When parsing a Homebrew cask stanza, the `run` guard uses `condition: 'on'` to restrict execution to an OS platform, but only `macos` and `linux` are supported. This error fires when the cask declares a `value` that is neither (or omits `value` entirely). The library throws it rather than silently running an artifact on an unvetted platform.

Source

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

        )
    })?;
    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 afd2eddd3a)

Solutions

  1. Open the cask's guard stanza and change `value` to one of the supported platforms: "macos" or "linux".
  2. Fix typos in the platform value (e.g. "osx" -> "macos").
  3. If the platform genuinely is unsupported, remove the guarded artifact or skip installing this cask with this tool.
  4. Check whether the cask comes from a newer Homebrew/core revision and update the cask/tap; if support for a new platform keyword is needed, file an issue upstream.

Example fix

// before (cask stanza)
{ "condition": "on", "value": "osx" }
// after
{ "condition": "on", "value": "macos" }
Defensive patterns

Strategy: validation

Validate before calling

const SUPPORTED = new Set(["macos", "linux"]);
function isSupportedPlatform(guard) {
  return guard?.condition !== "on" || SUPPORTED.has(guard?.value);
}
// pre-check each cask guard stanza before installing

Type guard

function hasSupportedGuardPlatform(g): g is { condition: "on"; value: "macos" | "linux" } {
  return g.condition === "on" && (g.value === "macos" || g.value === "linux");
}

Try / catch

try {
  installCask(token);
} catch (e) {
  if (String(e).includes("unsupported") && String(e).includes("run guard platform")) {
    console.warn(`Skipping ${token}: guard platform not supported`);
  } else throw e;
}

Prevention

When it happens

Trigger: Parsing a cask whose `run` (or similar flight) artifact has a guard object like {"condition":"on","value":"<unknown>"} with a value other than macos/linux, or {"condition":"on"} with no `value` key.

Common situations: Encountering a newly-published or hand-edited cask using a platform string Homebrew added recently (or a typo like 'osx', 'darwin', 'mac'), or a custom tap cask written for a platform this tool doesn't handle.

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