{"record":{"id":"b7bf21e39000f04a","repo":"jdx/mise","slug":"brew-cask-unsupported-kind-run-guard-platfor-b7bf21","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":965,"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":947,"sourceCodeEnd":983,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/system/packages/brew/cask/artifacts.rs#L947-L983","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Open the cask's guard stanza and change `value` to one of the supported platforms: \"macos\" or \"linux\".","Fix typos in the platform value (e.g. \"osx\" -> \"macos\").","If the platform genuinely is unsupported, remove the guarded artifact or skip installing this cask with this tool.","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."],"exampleFix":"// before (cask stanza)\n{ \"condition\": \"on\", \"value\": \"osx\" }\n// after\n{ \"condition\": \"on\", \"value\": \"macos\" }","handlingStrategy":"validation","validationCode":"const SUPPORTED = new Set([\"macos\", \"linux\"]);\nfunction isSupportedPlatform(guard) {\n  return guard?.condition !== \"on\" || SUPPORTED.has(guard?.value);\n}\n// pre-check each cask guard stanza before installing","typeGuard":"function hasSupportedGuardPlatform(g): g is { condition: \"on\"; value: \"macos\" | \"linux\" } {\n  return g.condition === \"on\" && (g.value === \"macos\" || g.value === \"linux\");\n}","tryCatchPattern":"try {\n  installCask(token);\n} catch (e) {\n  if (String(e).includes(\"unsupported\") && String(e).includes(\"run guard platform\")) {\n    console.warn(`Skipping ${token}: guard platform not supported`);\n  } else throw e;\n}","preventionTips":["Only use guard values macos/linux when authoring casks","Lint cask stanzas against the supported guard platform set before publishing","Re-fetch casks from upstream after Homebrew DSL changes"],"tags":["homebrew","cask","parsing","unsupported-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"}