jdx/mise · error

brew-cask:{}: {kind} terminate_process failure_message must

Error message

brew-cask:{}: {kind} terminate_process failure_message must be a string

What it means

The optional `failure_message` of a `terminate_process` step must be a string (or absent/null). If it is any other type — number, boolean, array, object — the parser bails with this error. This message is shown to the user when the step fails to terminate the process.

Source

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

                    .iter()
                    .map(|value| {
                        value.as_str().map(str::to_string).ok_or_else(|| {
                            eyre!(
                                "brew-cask:{}: {kind} terminate_process notices must be strings",
                                cask.token
                            )
                        })
                    })
                    .collect::<Result<Vec<_>>>()?,
                Some(_) => bail!(
                    "brew-cask:{}: {kind} terminate_process notices must be an array",
                    cask.token
                ),
            };
            let failure_message = match object.get("failure_message") {
                None | Some(Value::Null) => None,
                Some(Value::String(value)) => Some(value.clone()),
                Some(_) => bail!(
                    "brew-cask:{}: {kind} terminate_process failure_message must be a string",
                    cask.token
                ),
            };
            Ok(FlightStep::TerminateProcess {
                name: name.to_string(),
                match_mode,
                sudo,
                attempts,
                must_succeed,
                notices,
                failure_message,
            })
        }
        _ => bail!(
            "brew-cask:{}: unsupported {kind} step type {}",
            cask.token,
            step_type

View on GitHub (pinned to afd2eddd3a)

Solutions

  1. Change failure_message to a plain string: `failure_message = "MyApp is still running; close it and retry"`.
  2. Remove the key entirely if no custom message is desired.
  3. Convert the value to a string in the generator producing the cask file.

Example fix

// before
[[install.flight_steps]]
type = "terminate_process"
name = "MyApp"
failure_message = true
// after
[[install.flight_steps]]
type = "terminate_process"
name = "MyApp"
failure_message = "MyApp is still running; close it and retry"
Defensive patterns

Strategy: type-guard

Validate before calling

function validateFailureMessage(step) {
  if ('failure_message' in step && typeof step.failure_message !== 'string') {
    throw new Error(`failure_message must be a string, got ${typeof step.failure_message}`);
  }
}

Type guard

const isValidFailureMessage = (m) => m === undefined || typeof m === 'string';

Prevention

When it happens

Trigger: A cask sets `failure_message = 42`, `failure_message = true`, or an array/object in a terminate_process step; the `Some(_)` bail arm in parse_flight_step triggers.

Common situations: Accidentally assigning a variable holding a non-string value; quoting mistakes in TOML producing arrays; editing generated output where the field lost its string type.

Understand the failure class

Background: Type mismatch errors: IllegalArgumentException, TypeError and type guards across 150 open-source libraries — this error's family across 150 libraries.

Related errors


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