jdx/mise · error

brew-cask: : unsupported run command base

Error message

brew-cask:{}: unsupported {kind} run command base {}

What it means

When parsing a Homebrew cask's flight artifact (preflight/postflight/uninstall etc.), a run command's path object specified a "base" key whose value is not one of the recognized bases: "staged_path", "appdir", or "homebrew_prefix". The library only supports anchoring run commands to those base directories, so any other base string is rejected at parse time. This keeps flight step path resolution deterministic instead of guessing what an unknown base means.

Solutions

  1. Change the run command's "base" to one of the supported values: "staged_path", "appdir", or "homebrew_prefix".
  2. If the path needs no anchoring, remove the "base" key entirely so it defaults to FlightPathBase::Literal and use an absolute path.
  3. If the base is a legitimately new Homebrew base kind, extend parse_run_command in src/system/packages/brew/cask/artifacts.rs to map it to a new FlightPathBase variant.

Example fix

// before
{"path": {"base": "app_bundle", "path": "Contents/MacOS/tool"}}
// after
{"path": {"base": "appdir", "path": "Contents/MacOS/tool"}}
Defensive patterns

Strategy: validation

Validate before calling

const ALLOWED_RUN_BASES = new Set(["staged_path", "appdir", "homebrew_prefix"]);
function validateRunBase(cmd) {
  const base = cmd?.path?.base;
  if (base != null && !ALLOWED_RUN_BASES.has(base)) {
    throw new Error(`unsupported run command base: ${base}`);
  }
}

Type guard

function hasSupportedRunBase(cmd) {
  const base = cmd?.path?.base;
  return base == null || ["staged_path", "appdir", "homebrew_prefix"].includes(base);
}

Try / catch

try {
  parseFlightArtifact(caskJson);
} catch (err) {
  if (String(err).includes("unsupported") && String(err).includes("run command base")) {
    console.error(`Cask ${caskToken}: fix the run command "base" field`);
  }
  throw err;
}

Prevention

When it happens

Trigger: Calling parse_run_command (via FlightStep::Run) on a cask JSON artifact whose run command object contains e.g. {"base": "app_bundle", "path": "..."} or any typo'd/renamed base other than staged_path/appdir/homebrew_prefix, or omitting "base" while relying on a custom base semantics.

Common situations: Hand-editing a cask JSON, translating casks from other formats (e.g. custom installers) that use different base names, typos like "stagedpath" or "APPDIR", or upstream Homebrew adding a new base kind this port has not implemented yet.

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/01a8fabbb10f9873. Report an issue: GitHub.

Appendix: source

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

) -> 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",
            cask.token
        )
    })?;
    let base = match object.get("base").and_then(Value::as_str) {
        Some("staged_path") => FlightPathBase::StagedPath,
        Some("appdir") => FlightPathBase::AppDir,
        Some("homebrew_prefix") => FlightPathBase::HomebrewPrefix,
        Some(base) => bail!(
            "brew-cask:{}: unsupported {kind} run command base {}",
            cask.token,
            base
        ),
        None => FlightPathBase::Literal,
    };
    let path_value = Path::new(path);
    let invalid_absolute_path = base == FlightPathBase::Literal
        && !path_value.is_absolute()
        && path_value.components().count() > 1;
    let invalid_based_path = matches!(
        base,
        FlightPathBase::StagedPath | FlightPathBase::AppDir | FlightPathBase::HomebrewPrefix
    ) && (path_value.is_absolute()
        || path_value
            .components()
            .any(|component| matches!(component, Component::ParentDir)));
    if invalid_absolute_path || invalid_based_path {

View on GitHub (pinned to 533346cc37)