jdx/mise · error
brew-cask:{}: unsupported {kind} sudo setting
Error message
brew-cask:{}: unsupported {kind} sudo setting What it means
Thrown by parse_flight_sudo for the sudo setting of run steps. Accepted forms are exactly: absent or false (never sudo), true (always sudo), and the string "if_needed" (sudo only when the command fails without it). Any other value — "always", 1, "IfNeeded", null-as-string — falls to the wildcard arm.
Source
Thrown at src/system/packages/brew/cask.rs:5800
must_succeed,
notices,
failure_message,
})
}
_ => bail!(
"brew-cask:{}: unsupported {kind} step type {}",
cask.token,
step_type
),
}
}
fn parse_flight_sudo(cask: &Cask, kind: &str, value: Option<&Value>) -> Result<FlightSudo> {
match value {
None | Some(Value::Bool(false)) => Ok(FlightSudo::Never),
Some(Value::Bool(true)) => Ok(FlightSudo::Always),
Some(Value::String(value)) if value == "if_needed" => Ok(FlightSudo::IfNeeded),
_ => bail!("brew-cask:{}: unsupported {kind} sudo setting", cask.token),
}
}
fn parse_flight_guards(cask: &Cask, kind: &str, value: Option<&Value>) -> Result<Vec<FlightGuard>> {
value
.map(|guards| {
guards
.as_array()
.ok_or_else(|| {
eyre!(
"brew-cask:{}: unsupported {kind} guards metadata format",
cask.token
)
})?
.iter()
.map(|guard| parse_flight_guard(cask, kind, guard))
.collect::<Result<Vec<_>>>()
})View on GitHub (pinned to 6f52dcdf99)
Solutions
- Use "sudo": true for always, "sudo": false (or omit) for never
- Use the exact lowercase string "sudo": "if_needed" for conditional sudo
Example fix
// before
{"type": "run", "command": {...}, "sudo": "always"}
// after
{"type": "run", "command": {...}, "sudo": true} Defensive patterns
Strategy: validation
Validate before calling
fn sudo_ok(step: &serde_json::Value) -> bool {
match step.get("sudo") {
None | Some(serde_json::Value::Bool(_)) => true,
Some(serde_json::Value::String(s)) => s == "if_needed",
Some(_) => false,
}
} Type guard
fn is_valid_sudo(v: &serde_json::Value) -> bool {
v.is_boolean() || v.as_str() == Some("if_needed")
} Try / catch
match parse_flight_step(&cask, kind, &step) {
Ok(step) => { /* proceed */ }
Err(e) if e.to_string().contains("sudo setting") => {
eprintln!("sudo accepts true, false, or \"if_needed\" only");
}
Err(e) => return Err(e),
} Prevention
- Use booleans for always/never sudo; the exact string "if_needed" for conditional
- Do not copy sudo syntax from other tools' configs
When it happens
Trigger: A run step in preflight_steps/postflight_steps with "sudo": "always" / "sudo": 1 / "sudo": "yes"; parse_flight_sudo is called with that Option<&Value> and matches none of the three accepted arms.
Common situations: Assuming boolean-ish strings are coerced; copying sudo syntax from Homebrew's installer stanza (which uses different conventions); casing differences like "If_Needed".
Related errors
- brew-cask:{}: {kind} terminate_process match must be name or
- brew-cask:{}: unsupported {kind} step type {}
- brew-cask:{}: unsupported {kind} run command base {}
- brew-cask:{}: unsupported {kind} run guard platform {}
- brew-cask:{}: unsupported {kind} run guard condition {}
AI-assisted analysis of jdx/mise@6f52dcdf99 (2026-08-22).
Data as JSON: /api/errors/ccf38c5bd18f3df5.
Report an issue: GitHub.