jdx/mise · error

brew-cask:{}: unsupported {kind} {context} field {}

Error message

brew-cask:{}: unsupported {kind} {context} field {}

What it means

The cask stanza parser uses an allowlist for the keys it understands in each artifact/guard/path object (e.g. run guards allow condition, value, base, path, id). If the object contains any key outside the allowlist for that `{kind}`/`{context}`, this error lists the offending keys. This prevents silently ignoring stanza fields whose semantics might change behavior.

Source

Thrown at src/system/packages/brew/cask/artifacts.rs:1048

    reject_unsupported_flight_fields(cask, kind, field, object, &["base", "path"])?;
    parse_context_flight_path(cask, kind, field, object)
}

pub(super) fn reject_unsupported_flight_fields(
    cask: &Cask,
    kind: &str,
    context: &str,
    object: &serde_json::Map<String, Value>,
    allowed: &[&str],
) -> Result<()> {
    let mut unsupported = object
        .keys()
        .filter(|key| !allowed.contains(&key.as_str()))
        .cloned()
        .collect::<Vec<_>>();
    unsupported.sort();
    if !unsupported.is_empty() {
        bail!(
            "brew-cask:{}: unsupported {kind} {context} field {}",
            cask.token,
            unsupported.join(", ")
        );
    }
    Ok(())
}

pub(super) fn parse_flight_path(
    cask: &Cask,
    kind: &str,
    field: &str,
    value: Option<&Value>,
) -> Result<FlightPath> {
    let object = value.and_then(Value::as_object).ok_or_else(|| {
        eyre!(
            "brew-cask:{}: unsupported {kind} {field} metadata format",
            cask.token

View on GitHub (pinned to afd2eddd3a)

Solutions

  1. Remove the listed unsupported keys from the stanza object, or move them into a supported key's value.
  2. Fix typos so keys match the allowlist exactly (check the error message: it lists exactly which keys were rejected).
  3. Update the cask/tap to a revision whose stanza uses only supported fields.
  4. If a genuinely new DSL field is needed, remove the affected artifact or ask upstream to support the field.

Example fix

// before
{ "condition": "on", "value": "macos", "arch": "arm64" }
// after
{ "condition": "on", "value": "macos" }
Defensive patterns

Strategy: validation

Validate before calling

function hasOnlyAllowedKeys(obj, allowed) {
  return Object.keys(obj).every(k => allowed.includes(k));
}
// e.g. for run guards:
// hasOnlyAllowedKeys(guard, ["condition","value","base","path","id"])

Type guard

function isKnownKey<K extends string>(k: string, allowed: readonly K[]): k is K {
  return (allowed as readonly string[]).includes(k);
}

Try / catch

try {
  installCask(token);
} catch (e) {
  const m = String(e).match(/unsupported \S+ \S+ field (.+)/);
  if (m) {
    console.warn(`Cask has unsupported fields: ${m[1]} — strip them or update the tool`);
  } else throw e;
}

Prevention

When it happens

Trigger: A cask's flight/guard/path object contains unknown keys, e.g. a guard with `arch`, `args`, or `stdin` fields, or a renamed key like `conditions` instead of `condition`. The error names all unexpected keys, sorted and comma-joined.

Common situations: Casks using newer Homebrew DSL features (extra stanza fields) not yet supported, custom-tap casks with nonstandard keys, typos like `paths` instead of `path`, and machine-generated cask JSON with extra metadata.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


AI-assisted analysis of jdx/mise@afd2eddd3a (2026-09-09). Data as JSON: /api/errors/963d13acc9c195f9. Report an issue: GitHub.