{"record":{"id":"84fd41ff2528c48a","repo":"jdx/mise","slug":"brew-cask-unsupported-kind-run-guard-platfor-84fd41","errorCode":null,"errorMessage":"brew-cask:{}: unsupported {kind} run guard platform {}","messagePattern":"brew-cask:(.+?): unsupported (.+?) run guard platform (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/packages/brew/cask/artifacts.rs","lineNumber":960,"sourceCode":"pub(super) fn parse_flight_guard(cask: &Cask, kind: &str, value: &Value) -> Result<FlightGuard> {\n    let object = value.as_object().ok_or_else(|| {\n        eyre!(\n            \"brew-cask:{}: unsupported {kind} run guard metadata format\",\n            cask.token\n        )\n    })?;\n    reject_unsupported_flight_fields(\n        cask,\n        kind,\n        \"run guard\",\n        object,\n        &[\"condition\", \"value\", \"base\", \"path\", \"id\"],\n    )?;\n    match object.get(\"condition\").and_then(Value::as_str) {\n        Some(\"on\") => match object.get(\"value\").and_then(Value::as_str) {\n            Some(\"macos\") => Ok(FlightGuard::OnMacos),\n            Some(\"linux\") => Ok(FlightGuard::OnLinux),\n            Some(value) => bail!(\n                \"brew-cask:{}: unsupported {kind} run guard platform {}\",\n                cask.token,\n                value\n            ),\n            None => bail!(\n                \"brew-cask:{}: unsupported {kind} run guard platform\",\n                cask.token\n            ),\n        },\n        Some(condition @ (\"if_exists\" | \"unless_exists\")) => {\n            let path = parse_context_flight_path(cask, kind, \"run guard\", object)?;\n            if condition == \"if_exists\" {\n                Ok(FlightGuard::IfExists(path))\n            } else {\n                Ok(FlightGuard::UnlessExists(path))\n            }\n        }\n        Some(condition) => bail!(","sourceCodeStart":942,"sourceCodeEnd":978,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/system/packages/brew/cask/artifacts.rs#L942-L978","documentation":"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.","triggerScenarios":"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.","commonSituations":"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).","solutions":["Change the value to exactly \"macos\" or \"linux\".","Remove the guard if the step should run on all platforms.","Fix casing — the accepted values are lowercase."],"exampleFix":"// before\n[[install.flight_steps]]\ntype = \"run\"\ncommand = { base = \"staged_path\", path = \"bin/setup\" }\nguards = [{ condition = \"on\", value = \"darwin\" }]\n// after\n[[install.flight_steps]]\ntype = \"run\"\ncommand = { base = \"staged_path\", path = \"bin/setup\" }\nguards = [{ condition = \"on\", value = \"macos\" }]","handlingStrategy":"validation","validationCode":"const PLATFORMS = new Set(['macos', 'linux']);\nfunction validateGuards(step) {\n  for (const g of step.guards ?? []) {\n    if (g.condition === 'on' && !PLATFORMS.has(g.value)) {\n      throw new Error(`unsupported run guard platform: ${g.value}`);\n    }\n  }\n}","typeGuard":"const isValidPlatformGuard = (g) => g.condition !== 'on' || PLATFORMS.has(g.value);","tryCatchPattern":null,"preventionTips":["Use exactly \"macos\" or \"linux\" — not darwin/mac/windows.","Drop the guard when the step should run everywhere.","Lint guard objects against mise's accepted condition/value pairs in CI."],"tags":["brew-cask","config-validation","guards","platform","enum-value"],"backgroundTag":"invalid-enum-value","analyzedSha":"afd2eddd3a50c16190efc1c7e94404b48f72af57","analyzedAt":"2026-09-09T01:38:25.179Z","contentChangedAt":"2026-09-09T01:38:25.179Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}