{"record":{"id":"fef88b7a47f9888b","repo":"jdx/mise","slug":"brew-cask-unsupported-kind-run-guard-platfor","errorCode":null,"errorMessage":"brew-cask:{}: unsupported {kind} run guard platform {}","messagePattern":"brew-cask:(.+?): unsupported (.+?) run guard platform (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/packages/brew/cask.rs","lineNumber":5907,"sourceCode":"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":5889,"sourceCodeEnd":5925,"githubUrl":"https://github.com/jdx/mise/blob/6f52dcdf99e282ef7a7db68c81301fa4618d0f79/src/system/packages/brew/cask.rs#L5889-L5925","documentation":"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.","triggerScenarios":"{\"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.","commonSituations":"Using uname vocabulary (darwin/linux) instead of macos; attempting architecture guards via the platform slot; copying condition vocabulary from Homebrew's depends_on stanza.","solutions":["Use \"value\": \"macos\" or \"value\": \"linux\" with \"condition\": \"on\"","For existence checks, switch to \"condition\": \"if_exists\" / \"unless_exists\" with a path instead"],"exampleFix":"// before\n{\"condition\": \"on\", \"value\": \"darwin\"}\n// after\n{\"condition\": \"on\", \"value\": \"macos\"}","handlingStrategy":"validation","validationCode":"fn guard_ok(g: &serde_json::Value) -> bool {\n    if g.get(\"condition\").and_then(|c| c.as_str()) == Some(\"on\") {\n        return matches!(g.get(\"value\").and_then(|v| v.as_str()), Some(\"macos\") | Some(\"linux\"));\n    }\n    true\n}","typeGuard":"fn is_supported_platform(v: &serde_json::Value) -> bool {\n    matches!(v.as_str(), Some(\"macos\") | Some(\"linux\"))\n}","tryCatchPattern":"match parse_flight_guard(&cask, kind, &guard) {\n    Ok(g) => { /* proceed */ }\n    Err(e) if e.to_string().contains(\"run guard platform\") => {\n        eprintln!(\"platform guards accept only 'macos' or 'linux'\");\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Use 'macos' not 'darwin'; the vocabulary is macos/linux only","Do not encode architecture or arch conditions in the platform slot"],"tags":["brew-cask","mise","guards","enum-validation","flight-steps"],"backgroundTag":"brew-cask-stanza-validation","analyzedSha":"6f52dcdf99e282ef7a7db68c81301fa4618d0f79","analyzedAt":"2026-08-22T10:14:23.840Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}