jdx/mise · error

brew-cask:{}: {kind} {field} must be a boolean

Error message

brew-cask:{}: {kind} {field} must be a boolean

What it means

Boolean flight-step fields parsed via parse_optional_flight_bool (e.g. `must_succeed`, step-specific flags on Copy/Symlink/Run/terminate_process) must be actual booleans or absent. A non-boolean value (string "true", number 1, etc.) causes this bail with the offending field name interpolated.

Source

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

                .iter()
                .map(|guard| parse_flight_guard(cask, kind, guard))
                .collect::<Result<Vec<_>>>()
        })
        .transpose()
        .map(|guards| guards.unwrap_or_default())
}

pub(super) fn parse_optional_flight_bool(
    cask: &Cask,
    kind: &str,
    object: &serde_json::Map<String, Value>,
    field: &str,
    default: bool,
) -> Result<bool> {
    match object.get(field) {
        None => Ok(default),
        Some(Value::Bool(value)) => Ok(*value),
        Some(_) => bail!("brew-cask:{}: {kind} {field} must be a boolean", cask.token),
    }
}

pub(super) fn parse_run_command(
    cask: &Cask,
    kind: &str,
    value: Option<&Value>,
) -> Result<FlightPath> {
    let object = value.and_then(Value::as_object).ok_or_else(|| {
        eyre!(
            "brew-cask:{}: unsupported {kind} run command metadata format",
            cask.token
        )
    })?;
    reject_unsupported_flight_fields(cask, kind, "run command", object, &["base", "path"])?;
    let path = object.get("path").and_then(Value::as_str).ok_or_else(|| {
        eyre!(
            "brew-cask:{}: unsupported {kind} run command path",

View on GitHub (pinned to afd2eddd3a)

Solutions

  1. Change the field to a real boolean literal: `must_succeed = true` (unquoted).
  2. Remove the key to accept the field's default value.
  3. Fix the generator/template that is quoting or coercing the boolean.

Example fix

// before
[[install.flight_steps]]
type = "run"
command = { base = "staged_path", path = "bin/setup" }
must_succeed = "true"
// after
[[install.flight_steps]]
type = "run"
command = { base = "staged_path", path = "bin/setup" }
must_succeed = true
Defensive patterns

Strategy: validation

Validate before calling

const BOOL_FIELDS = ['must_succeed', 'force', 'should_fail'];
function validateBooleans(step) {
  for (const f of BOOL_FIELDS) {
    if (f in step && typeof step[f] !== 'boolean') {
      throw new Error(`${f} must be a boolean, got ${JSON.stringify(step[f])}`);
    }
  }
}

Type guard

const isBoolField = (v) => v === undefined || typeof v === 'boolean';

Prevention

When it happens

Trigger: A cask sets e.g. `must_succeed = "yes"` or `force = 1` on a Copy, Symlink, Run, or terminate_process step; parse_flight_step or a step-specific parser calls parse_optional_flight_bool and the `Some(_)` arm fires.

Common situations: YAML/TOML tooling coercing true to "true"; hand-writing 1/0 instead of true/false; generators emitting quoted booleans; copy-paste from formats where truthy strings are allowed.

Related errors


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