{"record":{"id":"22ed02b9028aa284","repo":"jdx/mise","slug":"brew-cask-unsupported-kind-context-field","errorCode":null,"errorMessage":"brew-cask:{}: unsupported {kind} {context} field {}","messagePattern":"brew-cask:(.+?): unsupported (.+?) (.+?) field (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/packages/brew/cask.rs","lineNumber":5995,"sourceCode":"    reject_unsupported_flight_fields(cask, kind, field, object, &[\"base\", \"path\"])?;\n    parse_context_flight_path(cask, kind, field, object)\n}\n\nfn reject_unsupported_flight_fields(\n    cask: &Cask,\n    kind: &str,\n    context: &str,\n    object: &serde_json::Map<String, Value>,\n    allowed: &[&str],\n) -> Result<()> {\n    let mut unsupported = object\n        .keys()\n        .filter(|key| !allowed.contains(&key.as_str()))\n        .cloned()\n        .collect::<Vec<_>>();\n    unsupported.sort();\n    if !unsupported.is_empty() {\n        bail!(\n            \"brew-cask:{}: unsupported {kind} {context} field {}\",\n            cask.token,\n            unsupported.join(\", \")\n        );\n    }\n    Ok(())\n}\n\nfn parse_flight_path(\n    cask: &Cask,\n    kind: &str,\n    field: &str,\n    value: Option<&Value>,\n) -> Result<FlightPath> {\n    let object = value.and_then(Value::as_object).ok_or_else(|| {\n        eyre!(\n            \"brew-cask:{}: unsupported {kind} {field} metadata format\",\n            cask.token","sourceCodeStart":5977,"sourceCodeEnd":6013,"githubUrl":"https://github.com/jdx/mise/blob/6f52dcdf99e282ef7a7db68c81301fa4618d0f79/src/system/packages/brew/cask.rs#L5977-L6013","documentation":"reject_unsupported_flight_fields is the strict allow-list for every flight (preflight_steps/postflight_steps) container: step groups, individual steps, run commands, and guards. Unknown keys are collected, sorted alphabetically, and reported comma-joined in the message with the kind, context (e.g. 'remove step', 'run guard'), and cask token. Like the artifact variant, it exists so new Homebrew fields fail loudly instead of being silently ignored.","triggerScenarios":"e.g. a remove step carrying a \"guards\" key (guards are only allowed on copy/symlink/run): message 'brew-cask:<token>: unsupported postflight_steps remove step field guards'; or a step group with a stray \"if\" key: 'unsupported preflight_steps step group field if'.","commonSituations":"Homebrew metadata gaining new per-step options that older mise rejects; copy-pasting fields between step types that support different option sets; leftover experimental keys in hand-authored cask JSON.","solutions":["Delete the key named in the message from that step object","Check the allowed list for the step type in parse_flight_step (src/system/packages/brew/cask.rs) to see where the field is actually supported","Update mise so newly supported fields parse; otherwise report the cask token upstream"],"exampleFix":"// before\n{\"type\": \"remove\", \"paths\": [\"/tmp/x\"], \"guards\": []}\n// after\n{\"type\": \"remove\", \"paths\": [\"/tmp/x\"]}","handlingStrategy":"validation","validationCode":"fn flight_fields_allowed(obj: &serde_json::Value, allowed: &[&str]) -> bool {\n    obj.as_object().map(|o| o.keys().all(|k| allowed.contains(&k.as_str()))).unwrap_or(true)\n}","typeGuard":null,"tryCatchPattern":"match cask_artifacts(&cask) {\n    Ok(a) => { /* proceed */ }\n    Err(e) if e.to_string().contains(\"unsupported\") && e.to_string().contains(\"field\") => {\n        eprintln!(\"cask {} uses a flight field outside this step's allow-list: {e}\", cask.token);\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Each step type has its own allowed option set — do not copy fields between step types","guards only belong on steps whose allow-list names them (copy/symlink/run)","Re-run custom casks through mise after upgrading to catch vocabulary drift early"],"tags":["brew-cask","mise","flight-steps","allow-list","unknown-field"],"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"}