jdx/mise · error

brew-cask: : terminate_process match must be name or full

Error message

brew-cask:{}: {kind} terminate_process match must be name or full

What it means

The optional `match` field of a `terminate_process` flight step controls how `name` is interpreted: `"name"` (default) matches the process name exactly, `"full"` matches the full command line. Any other value — or a non-string — is rejected with this error naming the cask token and step kind.

Solutions

  1. Change `match` to either "name" or "full".
  2. Remove the `match` field entirely to use the default ("name") behavior.

Example fix

// before
[[flight.steps]]
type = "terminate_process"
name = "myapp"
match = "exact"
// after
[[flight.steps]]
type = "terminate_process"
name = "myapp"
match = "full"
Defensive patterns

Strategy: validation

Validate before calling

if (step.match !== undefined && !["name", "full"].includes(step.match))
  throw new Error(`invalid match mode: ${step.match}`);

Type guard

function isProcessMatch(v) {
  return v === undefined || v === "name" || v === "full";
}

Try / catch

try {
  parseCaskArtifacts(cask);
} catch (err) {
  if (err.message.includes("match must be name or full")) {
    // normalize the match value or drop the field
  } else throw err;
}

Prevention

When it happens

Trigger: A terminate_process step with `match` set to something other than "name" or "full", e.g. `match = "exact"`, `match = "prefix"`, or a non-string value like `match = true`.

Common situations: Guessing at match modes not in the schema, copying values from other tools' process-matching APIs (e.g. pgrep patterns), or typoing "fullname"/"cmdline".

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


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

Appendix: source

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

                ],
            )?;
            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,
                Some(value) => value
                    .as_u64()
                    .and_then(|value| usize::try_from(value).ok())
                    .filter(|value| *value > 0)
                    .ok_or_else(|| {
                        eyre!(
                            "brew-cask:{}: {kind} terminate_process attempts must be a positive integer",
                            cask.token
                        )

View on GitHub (pinned to 533346cc37)