jdx/mise · error

brew-cask:{}: {kind} terminate_process name must not be empt

Error message

brew-cask:{}: {kind} terminate_process name must not be empty

What it means

Thrown while parsing a terminate_process step inside preflight_steps/postflight_steps. The step's 'name' field was found and is a string, but it is empty — there is no process name to match against, so the step could never fire and is rejected at parse time rather than becoming a silent no-op.

Source

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

                &[
                    "type",
                    "name",
                    "match",
                    "sudo",
                    "attempts",
                    "must_succeed",
                    "notices",
                    "failure_message",
                ],
            )?;
            let name = object.get("name").and_then(Value::as_str).ok_or_else(|| {
                eyre!(
                    "brew-cask:{}: {kind} terminate_process name must be a string",
                    cask.token
                )
            })?;
            if name.is_empty() {
                bail!(
                    "brew-cask:{}: {kind} terminate_process name must not be empty",
                    cask.token
                );
            }
            let match_mode = match object.get("match") {
                None => ProcessMatch::Name,
                Some(Value::String(value)) if value == "name" => ProcessMatch::Name,
                Some(Value::String(value)) if value == "full" => ProcessMatch::Full,
                _ => bail!(
                    "brew-cask:{}: {kind} terminate_process match must be name or full",
                    cask.token
                ),
            };
            let sudo = parse_optional_flight_bool(cask, kind, object, "sudo", false)?;
            let must_succeed =
                parse_optional_flight_bool(cask, kind, object, "must_succeed", false)?;
            let attempts = match object.get("attempts") {
                None => 1,

View on GitHub (pinned to 6f52dcdf99)

Solutions

  1. Set name to the real process name to match, e.g. "name": "myapp-helper"
  2. Use "match": "full" with the full executable path in name if a bare name is ambiguous
  3. If the step is not needed, delete the whole terminate_process step object

Example fix

// before
{"type": "terminate_process", "name": ""}
// after
{"type": "terminate_process", "name": "zoom.us", "match": "name"}
Defensive patterns

Strategy: validation

Validate before calling

fn terminate_process_steps_ok(v: &serde_json::Value) -> bool {
    let Some(groups) = v.as_object().and_then(|o| {
        o.get("preflight_steps").or_else(|| o.get("postflight_steps"))
    }).and_then(|g| g.as_array()) else { return true; };
    groups.iter().all(|g| g.get("steps").and_then(|s| s.as_array()).map(|steps| {
        steps.iter().all(|s| {
            s.get("type").and_then(|t| t.as_str()) != Some("terminate_process")
                || s.get("name").and_then(|n| n.as_str()).map(|n| !n.is_empty()).unwrap_or(false)
        })
    }).unwrap_or(true))
}

Try / catch

match parse_flight_step(&cask, kind, &step) {
    Ok(step) => { /* proceed */ }
    Err(e) if e.to_string().contains("terminate_process name must not be empty") => {
        eprintln!("cask {token}: terminate_process step needs a real process name", token = cask.token);
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: {"type": "terminate_process", "name": ""} inside any step of a preflight_steps or postflight_steps group; the cask token and kind (preflight_steps/postflight_steps) are interpolated into the message.

Common situations: Templated cask JSON where the process-name variable was empty; placeholders left in hand-written steps; refactors that moved the process name into 'match' by mistake.

Related errors


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