{"record":{"id":"5fa1372a1da2295d","repo":"jdx/mise","slug":"brew-cask-unsupported-context-field","errorCode":null,"errorMessage":"brew-cask: unsupported {context} field {}","messagePattern":"brew-cask: unsupported (.+?) field (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/packages/brew/cask.rs","lineNumber":5282,"sourceCode":"        .unwrap_or_default();\n    Ok(Some(InstallerArtifact {\n        executable: executable.to_string(),\n        args,\n    }))\n}\n\nfn reject_unsupported_artifact_fields(\n    context: &str,\n    object: &serde_json::Map<String, Value>,\n    allowed: &[&str],\n) -> Result<()> {\n    let unsupported = object\n        .keys()\n        .filter(|key| !allowed.contains(&key.as_str()))\n        .cloned()\n        .collect::<Vec<_>>();\n    if !unsupported.is_empty() {\n        bail!(\n            \"brew-cask: unsupported {context} field {}\",\n            unsupported.join(\", \")\n        );\n    }\n    Ok(())\n}\n\nfn parse_generic_artifact(value: &Value) -> Result<Option<GenericArtifact>> {\n    let Some(artifact) = value.as_object().and_then(|object| object.get(\"artifact\")) else {\n        return Ok(None);\n    };\n    let values = artifact\n        .as_array()\n        .ok_or_else(|| eyre!(\"brew-cask: artifact metadata must be an array\"))?;\n    let source = values\n        .first()\n        .and_then(Value::as_str)\n        .ok_or_else(|| eyre!(\"brew-cask: artifact requires a source\"))?;","sourceCodeStart":5264,"sourceCodeEnd":5300,"githubUrl":"https://github.com/jdx/mise/blob/6f52dcdf99e282ef7a7db68c81301fa4618d0f79/src/system/packages/brew/cask.rs#L5264-L5300","documentation":"Thrown by reject_unsupported_artifact_fields, a strict allow-list check shared by artifact parsers. Every key in the artifact's JSON object must appear in that artifact type's allowed list; any leftover keys are collected and reported (comma-joined) in the message. This is deliberate fail-fast behavior so new or unrecognized Homebrew artifact fields do not get silently dropped.","triggerScenarios":"Any artifact object containing a key outside its allow-list, e.g. a binary artifact carrying an extra \"only_if\" key or an app artifact with \"when\" — the message names the context and the offending key(s), e.g. 'brew-cask: unsupported binary artifact field only_if'.","commonSituations":"Homebrew adds a new artifact sub-field and an older mise rejects it; hand-crafted cask JSON with typos or fields copied from a different artifact type; conversion scripts that pass through unknown keys.","solutions":["Remove the offending key named in the error message from the artifact object","Check the allowed list for that artifact type in src/system/packages/brew/cask.rs to see which spellings are accepted","Update mise — if the field is now supported the newer allow-list will accept it; otherwise report the cask token upstream"],"exampleFix":"// before\n{\"binary\": [\"tool\"], \"only_if\": {\"condition\": \"on\", \"value\": \"macos\"}}\n// after\n{\"binary\": [\"tool\"]}","handlingStrategy":"validation","validationCode":"fn artifact_fields_allowed(v: &serde_json::Value, allowed: &[&str]) -> bool {\n    v.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().starts_with(\"brew-cask: unsupported\") && e.to_string().contains(\"field\") => {\n        eprintln!(\"cask {} uses an artifact field mise does not support: {e}\", cask.token);\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Keep artifact objects minimal — only the documented keys for that artifact type","When Homebrew metadata changes, upgrade mise before retrying the cask","Validate custom cask JSON against the allowed lists in src/system/packages/brew/cask.rs"],"tags":["brew-cask","mise","config-validation","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"}