{"record":{"id":"76f53068395bf4d7","repo":"jdx/mise","slug":"brew-cask-unsupported-kind-run-guard-platfor-76f530","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":5912,"sourceCode":"        )\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!(\n            \"brew-cask:{}: unsupported {kind} run guard condition {}\",\n            cask.token,\n            condition\n        ),\n        None => bail!(","sourceCodeStart":5894,"sourceCodeEnd":5930,"githubUrl":"https://github.com/jdx/mise/blob/6f52dcdf99e282ef7a7db68c81301fa4618d0f79/src/system/packages/brew/cask.rs#L5894-L5930","documentation":"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.","triggerScenarios":"{\"condition\": \"on\"} with no value key, or \"value\": 1 / {\"os\": \"macos\"} — anything where value.as_str() is None.","commonSituations":"Truncated guard objects from templating; assuming \"on\" alone means 'on macOS'; placing the platform in a differently named key (\"platform\", \"os\").","solutions":["Add the platform string: {\"condition\": \"on\", \"value\": \"macos\"} or \"linux\"","If you meant an existence check, use condition if_exists/unless_exists with base/path instead"],"exampleFix":"// before\n{\"condition\": \"on\"}\n// after\n{\"condition\": \"on\", \"value\": \"macos\"}","handlingStrategy":"validation","validationCode":"fn guard_on_has_value(g: &serde_json::Value) -> bool {\n    if g.get(\"condition\").and_then(|c| c.as_str()) == Some(\"on\") {\n        return g.get(\"value\").and_then(|v| v.as_str()).is_some();\n    }\n    true\n}","typeGuard":null,"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!(\"a 'condition: on' guard also needs a string 'value' (macos/linux)\");\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Treat condition 'on' and value as a pair — never emit one without the other","Guard templates should skip the guard entirely when the platform variable is empty"],"tags":["brew-cask","mise","guards","missing-field","flight-steps"],"backgroundTag":"brew-cask-stanza-validation","analyzedSha":"6f52dcdf99e282ef7a7db68c81301fa4618d0f79","analyzedAt":"2026-08-22T10:14:23.840Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}