jdx/mise · error

brew-cask: unsupported {context} field {}

Error message

brew-cask: unsupported {context} field {}

What it means

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.

Source

Thrown at src/system/packages/brew/cask.rs:5282

        .unwrap_or_default();
    Ok(Some(InstallerArtifact {
        executable: executable.to_string(),
        args,
    }))
}

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

fn parse_generic_artifact(value: &Value) -> Result<Option<GenericArtifact>> {
    let Some(artifact) = value.as_object().and_then(|object| object.get("artifact")) else {
        return Ok(None);
    };
    let values = artifact
        .as_array()
        .ok_or_else(|| eyre!("brew-cask: artifact metadata must be an array"))?;
    let source = values
        .first()
        .and_then(Value::as_str)
        .ok_or_else(|| eyre!("brew-cask: artifact requires a source"))?;

View on GitHub (pinned to 6f52dcdf99)

Solutions

  1. Remove the offending key named in the error message from the artifact object
  2. Check the allowed list for that artifact type in src/system/packages/brew/cask.rs to see which spellings are accepted
  3. Update mise — if the field is now supported the newer allow-list will accept it; otherwise report the cask token upstream

Example fix

// before
{"binary": ["tool"], "only_if": {"condition": "on", "value": "macos"}}
// after
{"binary": ["tool"]}
Defensive patterns

Strategy: validation

Validate before calling

fn artifact_fields_allowed(v: &serde_json::Value, allowed: &[&str]) -> bool {
    v.as_object().map(|o| o.keys().all(|k| allowed.contains(&k.as_str()))).unwrap_or(true)
}

Try / catch

match cask_artifacts(&cask) {
    Ok(a) => { /* proceed */ }
    Err(e) if e.to_string().starts_with("brew-cask: unsupported") && e.to_string().contains("field") => {
        eprintln!("cask {} uses an artifact field mise does not support: {e}", cask.token);
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: 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'.

Common situations: 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.

Related errors


AI-assisted analysis of jdx/mise@6f52dcdf99 (2026-08-22). Data as JSON: /api/errors/5fa1372a1da2295d. Report an issue: GitHub.