jdx/mise · error

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

Error message

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

What it means

During a cask's structured flight (post-install artifact moves), a non-glob move source declared in the cask's stanza is resolved against the staged path and checked for existence. Homebrew throws this when the resolved file/directory does not exist inside the staging area. It guards `move` steps against missing or misnamed sources before any filesystem mutation.

Source

Thrown at src/system/packages/brew/cask/flight.rs:986

        FlightSudo::Never => file::create_dir_all(target),
        FlightSudo::IfNeeded => create_dir_all_elevating(target),
        FlightSudo::Always => sudo::run(
            "/bin/mkdir",
            &["-p".into(), "--".into(), target.display().to_string()],
            &[],
        ),
    }
}

pub(super) fn flight_sources(
    staged_path: &Path,
    source: &FlightPath,
    source_glob: bool,
) -> Result<Vec<PathBuf>> {
    if !source_glob {
        let source = resolve_flight_path(staged_path, source)?;
        if !source.exists() {
            bail!(
                "brew-cask: structured move source '{}' was not found",
                source.display()
            );
        }
        return Ok(vec![source]);
    }
    // Homebrew marks move sources as globs explicitly; non-glob move sources
    // may contain literal glob-like characters and should be resolved literally.
    let sources = expand_staged_glob(staged_path, &source.path)?;
    if sources.is_empty() {
        bail!(
            "brew-cask: structured move source '{}' was not found",
            source.path
        );
    }
    Ok(sources)
}

View on GitHub (pinned to afd2eddd3a)

Solutions

  1. Verify the staged install (e.g. `brew --cache` / the staging dir) and check the actual artifact name
  2. Correct the move source path in the cask stanza to match the staged layout
  3. Add glob characters only if intentional variability is needed, and set source_glob accordingly
  4. Re-run brew install after fixing the cask

Example fix

// before
move "/Applications/OldName.app", "/Applications"
// after
move staged_path.join("AppName.app"), "/Applications"  // match actual staged name
Defensive patterns

Strategy: validation

Validate before calling

let src = staged_path.join(rel_source);
if !src.exists() {
    return Err(format!("staged move source missing: {}", src.display()));
}

Prevention

When it happens

Trigger: A cask stanza declares a `staged_path`-based move source whose literal path (after resolving) is absent from the staged install — e.g. the app/binary name changed upstream, a case-mismatch, or the cask authors forgot a directory component.

Common situations: Cask DSL authors writing `move` stanzas after an upstream project renamed its .app bundle or binary; users hitting it when a cask is out of sync with a newly released upstream artifact layout.

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


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