jdx/mise · error

brew-cask: : terminate_process name must not be empty

Error message

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

What it means

Within a cask flight step (`pre`/`post`/uninstall-style `terminate_process` step), the `name` field identifies the process to terminate. If `name` is present but an empty string, parsing fails because an empty process name would match nothing or everything unpredictably. The error includes the cask token and step kind for pinpointing the offending definition.

Solutions

  1. Set `name` to the actual process name, e.g. `name = "MyApp Helper"`.
  2. Remove the terminate_process step if no process should be terminated.

Example fix

// before
[[cask.flight.steps]]
type = "terminate_process"
name = ""
// after
[[cask.flight.steps]]
type = "terminate_process"
name = "MyApp Helper"
Defensive patterns

Strategy: validation

Validate before calling

for (const step of flightSteps) {
  if (step.type === "terminate_process" && (typeof step.name !== "string" || step.name === ""))
    throw new Error("terminate_process name must be a non-empty string");
}

Type guard

function isNonEmptyString(v) {
  return typeof v === "string" && v.trim().length > 0;
}

Try / catch

try {
  parseCaskArtifacts(cask);
} catch (err) {
  if (err.message.includes("terminate_process name must not be empty")) {
    // fill in the process name for the step/cask named in the message
  } else throw err;
}

Prevention

When it happens

Trigger: A `terminate_process` flight step defined with `name = ""` in a `pre_flight`/`post_flight` (or uninstall) steps array of a cask.

Common situations: Copy-pasting a terminate_process step and forgetting to fill in the process name, or interpolating a variable that resolved to empty.

Understand the failure class

Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.

Related errors


AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17). Data as JSON: /api/errors/72dc464fbb7c8f41. Report an issue: GitHub.

Appendix: source

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

                &[
                    "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 533346cc37)