jdx/mise · error
brew-cask: structured copy source '{}' was not found
Error message
brew-cask: structured copy source '{}' was not found What it means
The resolved source path of a brew-cask structured copy step does not exist on disk. The library checks existence after resolving the cask's source path (template-expanded against staged_path/appdir) and refuses to copy a missing artifact.
Source
Thrown at src/system/packages/brew/cask/flight.rs:654
}
}
FlightStep::Copy {
source,
target,
recursive,
overwrite,
source_glob,
guards,
} => {
if !flight_guards_pass(cask, guards, staged_path, appdir)? {
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 afd2eddd3a)
Solutions
- Check the resolved path exists in the staging directory; fix the source template/path in the cask definition.
- Ensure no earlier flight step (Remove/Move) deletes the file before the Copy step runs.
- Verify against the currently installed version's staged contents — upstream may have renamed the artifact.
Example fix
// before source: "bin/legacy-cli" // after (renamed in new version) source: "bin/new-cli"
Defensive patterns
Strategy: validation
Validate before calling
let source = resolve_flight_path_with_context(cask, source, staged_path, appdir)?;
if !source.exists() {
return Err(eyre!("copy source missing: {}", source.display()));
} Prevention
- Verify template variables ({{version}}, {{arch}}) render to real paths in the staged tree.
- Order flight steps so sources are not removed before copying.
- Re-check the cask definition after upstream app bundle renames.
When it happens
Trigger: FlightStep::Copy whose source path (literal or glob result) is absent at execution time: wrong template variable ({{version}}, {{arch}}), file removed by an earlier Remove/Move step, or upstream changed bundled filenames.
Common situations: Cask definitions pinning old artifact names after an app restructured its bundle; macOS app bundles renamed between versions; source referencing a path created only under a guard that didn't pass.
Understand the failure class
Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.
Related errors
- brew-cask: font artifact '{}' was not staged
- brew-cask: binary artifact '{}' was not staged
- brew-cask: command wrapper '{}' was not staged
- brew-cask: font artifact '{}' was not staged
- brew-cask: completion artifact '{}' was not staged
AI-assisted analysis of jdx/mise@afd2eddd3a (2026-09-09).
Data as JSON: /api/errors/2743fd6051e5d7d9.
Report an issue: GitHub.