jdx/mise · error

brew-cask: structured copy source '{}' was not found

Error message

brew-cask: structured copy source '{}' was not found

What it means

A structured copy step resolved its source to exactly one path, but that path does not exist on disk. Source resolution first expands templates ({{version}}, {{version.major}}, $APPDIR, {{staged_path}}, etc.) and joins the result to the staged caskroom path, so a wrong template expansion or a missing payload file both surface here.

Source

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

            overwrite,
            source_glob,
            guards,
        } => {
            if !guards
                .iter()
                .map(|guard| flight_guard_matches(cask, guard, staged_path, appdir))
                .collect::<Result<Vec<_>>>()?
                .into_iter()
                .all(|matches| matches)
            {
                return Ok(());
            }
            let sources = flight_symlink_sources(cask, source, *source_glob, staged_path, appdir)?;
            let [source] = sources.as_slice() else {
                bail!("brew-cask: structured copy source must resolve to exactly one path");
            };
            if !source.exists() {
                bail!(
                    "brew-cask: structured copy source '{}' was not found",
                    source.display()
                );
            }
            if source.is_dir() && !recursive {
                bail!("brew-cask: structured directory copy requires recursive=true");
            }
            let target = resolve_flight_path_with_context(cask, target, staged_path, appdir)?;
            let external = !target.starts_with(staged_path);
            let target_metadata = target.symlink_metadata().ok();
            if target_metadata.is_some() {
                if !overwrite {
                    bail!(
                        "brew-cask: structured copy target '{}' already exists",
                        target.display()
                    );
                }
                if external {

View on GitHub (pinned to 9dcfcaa0dc)

Solutions

  1. List the staged directory and confirm the actual payload file/dir names versus the copy source in the message
  2. Restage cleanly: mise uninstall <tap>/<token> then mise install <tap>/<token>
  3. Verify the cask's declared version matches the payload layout used by the source template
  4. If the upstream metadata points at a file the archive never ships, report it to homebrew-cask

Example fix

# before: interrupted install left a partial staged tree
ls "$(brew --caskroom)/<token>/<version>"   # expected payload missing
# after: restage and reinstall
mise uninstall <tap>/<token> && mise install <tap>/<token>
Defensive patterns

Strategy: validation

Validate before calling

STAGED="$(brew --caskroom)/<token>/<version>"
test -e "$STAGED/<expected-source>" || echo "copy source missing - restage (mise uninstall && mise install)"

Prevention

When it happens

Trigger: Running mise install for a cask whose copy source, after template expansion, names a file absent from the staged directory: version metadata mismatch ({{version.major}} vs full version), payload renamed upstream, or a partially staged tree left by an interrupted earlier install.

Common situations: Cask version bumps that change payload layout without updating artifact paths; an interrupted prior install that left the caskroom directory incomplete; cask JSON written for a different archive structure.

Related errors


AI-assisted analysis of jdx/mise@9dcfcaa0dc (2026-08-17). Data as JSON: /api/errors/3b34788292462e8d. Report an issue: GitHub.