jdx/mise · error
brew-cask:{}: unsupported {kind} run guard condition
Error message
brew-cask:{}: unsupported {kind} run guard condition What it means
Thrown when a guard object has no readable condition at all: object.get("condition").and_then(as_str) returns None because the key is absent or holds a non-string. Without a condition the guard cannot be classified, so parsing the whole cask fails. The message has no value placeholder, distinguishing it from the unknown-condition-string variant.
Source
Thrown at src/system/packages/brew/cask.rs:5930
None => bail!(
"brew-cask:{}: unsupported {kind} run guard platform",
cask.token
),
},
Some(condition @ ("if_exists" | "unless_exists")) => {
let path = parse_context_flight_path(cask, kind, "run guard", object)?;
if condition == "if_exists" {
Ok(FlightGuard::IfExists(path))
} else {
Ok(FlightGuard::UnlessExists(path))
}
}
Some(condition) => bail!(
"brew-cask:{}: unsupported {kind} run guard condition {}",
cask.token,
condition
),
None => bail!(
"brew-cask:{}: unsupported {kind} run guard condition",
cask.token
),
}
}
fn parse_context_flight_path(
cask: &Cask,
kind: &str,
field: &str,
object: &serde_json::Map<String, Value>,
) -> Result<FlightPath> {
let path = object
.get("path")
.and_then(Value::as_str)
.ok_or_else(|| eyre!("brew-cask:{}: unsupported {kind} {field} path", cask.token))?;
let base = match object.get("base").and_then(Value::as_str) {
Some("staged_path") => FlightPathBase::StagedPath,View on GitHub (pinned to 6f52dcdf99)
Solutions
- Add "condition" as one of "on", "if_exists", "unless_exists"
- If the guard was meant to be a platform check, also add the matching "value"
Example fix
// before
{"guards": [{"path": "/tmp/lock"}]}
// after
{"guards": [{"condition": "unless_exists", "path": "/tmp/lock"}]} Defensive patterns
Strategy: validation
Validate before calling
fn guard_has_condition(g: &serde_json::Value) -> bool {
g.get("condition").and_then(|c| c.as_str()).is_some()
} Try / catch
match parse_flight_guard(&cask, kind, &guard) {
Ok(g) => { /* proceed */ }
Err(e) if e.to_string().contains("run guard condition") && !e.to_string().contains("condition ") => {
eprintln!("every guard object needs a string 'condition' key");
}
Err(e) => return Err(e),
} Prevention
- Always include a string 'condition' as the first key of a guard
- Lint generated cask JSON for guard objects that lack a condition
When it happens
Trigger: {"guards": [{"path": "/tmp/x"}]} — a guard with path fields but no "condition" key; or {"condition": ["on"]} where condition is an array.
Common situations: Typing the key wrongly ("conditions", "when", "check"); templating that drops empty condition variables; refactors that renamed the field.
Related errors
- brew-cask:{}: unsupported {kind} run guard platform
- brew-cask:{}: unsupported {kind} run guard platform {}
- brew-cask:{}: unsupported {kind} run guard condition {}
- brew-cask:{}: {kind} terminate_process name must not be empt
- brew-cask:{}: {kind} terminate_process match must be name or
AI-assisted analysis of jdx/mise@6f52dcdf99 (2026-08-22).
Data as JSON: /api/errors/dd77164a18460778.
Report an issue: GitHub.