jdx/mise · error

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

Error message

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

What it means

A non-glob `move` step's source, resolved literally against the staged path, does not exist. Move sources without `source_glob` are resolved as-is (they may legitimately contain glob-like characters as literal file-name characters), so the exact named file must be present in the staged payload.

Source

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

        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()],
            &[],
        ),
    }
}

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 6f52dcdf99)

Solutions

  1. Check the exact file name inside the staged caskroom directory and fix the `source` string
  2. Set `source_glob: true` on the move step if the name was intended as a wildcard
  3. Re-stage the payload (fresh download) to rule out partial extraction

Example fix

# before - wildcard characters are literal without the flag
move(source: "lib/*.dylib", target: "#{staged}/lib")
# after
move(source: "lib/*.dylib", target: "#{staged}/lib", source_glob: true)
Defensive patterns

Strategy: validation

Validate before calling

// Literal (non-glob) move sources must exist exactly as written
let source = resolve_flight_path(staged_path, &step.source)?;
if !source.exists() {
    return Err(eyre!("move source '{}' not in staged payload; check spelling or set source_glob", source.display()));
}

Try / catch

if err.to_string().contains("move source") && err.to_string().contains("was not found") {
    // decide literal-typo vs intended-wildcard, then fix or set source_glob: true
}

Prevention

When it happens

Trigger: `move` without `source_glob` referencing a file that was never extracted into the staged directory; a source whose name literally contains `*`, `?` or `[` that the author actually intended as a wildcard (which requires the flag).

Common situations: Upstream renamed the moved file between versions; the author wrote a wildcard assuming glob semantics; case mismatch between the stanza and the archive.

Related errors


AI-assisted analysis of jdx/mise@6f52dcdf99 (2026-08-22). Data as JSON: /api/errors/9fbfd6f83aa67901. Report an issue: GitHub.