{"record":{"id":"fac3615b89b612f7","repo":"jdx/mise","slug":"brew-cask-unsupported-kind-run-guard-conditi-fac361","errorCode":null,"errorMessage":"brew-cask:{}: unsupported {kind} run guard condition {}","messagePattern":"brew-cask:(.+?): unsupported (.+?) run guard condition (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/packages/brew/cask/artifacts.rs","lineNumber":978,"sourceCode":"            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!(\n            \"brew-cask:{}: unsupported {kind} run guard condition\",\n            cask.token\n        ),\n    }\n}\n\npub(super) fn parse_context_flight_path(\n    cask: &Cask,\n    kind: &str,\n    field: &str,\n    object: &serde_json::Map<String, Value>,\n) -> Result<FlightPath> {\n    let path = object","sourceCodeStart":960,"sourceCodeEnd":996,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/system/packages/brew/cask/artifacts.rs#L960-L996","documentation":"A cask `run` guard's `condition` key must be one of `on`, `if_exists`, or `unless_exists`. This error is raised when the guard object specifies some other condition string. The library refuses to interpret guards it doesn't understand instead of executing artifacts under wrong conditions.","triggerScenarios":"Parsing a cask whose guard object has {\"condition\":\"<other>\", ...} where <other> is not `on`, `if_exists`, or `unless_exists` (e.g. `on_system`, `does_not_exist`, a quoted or renamed condition).","commonSituations":"Casks written against a newer Homebrew DSL version that added a new guard condition, custom-tap casks with hand-written conditions, or renamed/mistranslated condition keys in local cask edits.","solutions":["Change the guard's `condition` to one of: \"on\", \"if_exists\", \"unless_exists\".","If the intent is platform gating, use {\"condition\":\"on\",\"value\":\"macos\"|\"linux\"}.","For path-based gating, use if_exists/unless_exists with `path` and optionally `base`.","Remove the guard if the artifact should run unconditionally; consider opening an upstream issue if a new Homebrew condition needs support."],"exampleFix":"// before\nguard { \"condition\": \"on_system_run\", \"value\": \"macos\" }\n// after\nguard { \"condition\": \"on\", \"value\": \"macos\" }","handlingStrategy":"validation","validationCode":"const COND = new Set([\"on\", \"if_exists\", \"unless_exists\"]);\nfunction hasKnownCondition(guard) {\n  return typeof guard?.condition === \"string\" && COND.has(guard.condition);\n}","typeGuard":"function isKnownGuard(g): g is { condition: \"on\" | \"if_exists\" | \"unless_exists\" } {\n  return [\"on\", \"if_exists\", \"unless_exists\"].includes(g?.condition);\n}","tryCatchPattern":"try {\n  installCask(token);\n} catch (e) {\n  if (String(e).includes(\"run guard condition\")) {\n    console.warn(`Cask ${token} uses an unsupported guard condition; skipping guarded artifact`);\n  } else throw e;\n}","preventionTips":["Author guards only with on/if_exists/unless_exists","Diff custom taps against Homebrew DSL docs before use","Pin tap revisions so DSL changes don't appear unexpectedly"],"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"}