{"record":{"id":"3b34788292462e8d","repo":"jdx/mise","slug":"brew-cask-structured-copy-source-was-not-fou","errorCode":null,"errorMessage":"brew-cask: structured copy source '{}' was not found","messagePattern":"brew-cask: structured copy source '(.+?)' was not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/packages/brew/cask.rs","lineNumber":3440,"sourceCode":"            overwrite,\n            source_glob,\n            guards,\n        } => {\n            if !guards\n                .iter()\n                .map(|guard| flight_guard_matches(cask, guard, staged_path, appdir))\n                .collect::<Result<Vec<_>>>()?\n                .into_iter()\n                .all(|matches| matches)\n            {\n                return Ok(());\n            }\n            let sources = flight_symlink_sources(cask, source, *source_glob, staged_path, appdir)?;\n            let [source] = sources.as_slice() else {\n                bail!(\"brew-cask: structured copy source must resolve to exactly one path\");\n            };\n            if !source.exists() {\n                bail!(\n                    \"brew-cask: structured copy source '{}' was not found\",\n                    source.display()\n                );\n            }\n            if source.is_dir() && !recursive {\n                bail!(\"brew-cask: structured directory copy requires recursive=true\");\n            }\n            let target = resolve_flight_path_with_context(cask, target, staged_path, appdir)?;\n            let external = !target.starts_with(staged_path);\n            let target_metadata = target.symlink_metadata().ok();\n            if target_metadata.is_some() {\n                if !overwrite {\n                    bail!(\n                        \"brew-cask: structured copy target '{}' already exists\",\n                        target.display()\n                    );\n                }\n                if external {","sourceCodeStart":3422,"sourceCodeEnd":3458,"githubUrl":"https://github.com/jdx/mise/blob/9dcfcaa0dc8747a2577d3270b69bb9d8313b2807/src/system/packages/brew/cask.rs#L3422-L3458","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["List the staged directory and confirm the actual payload file/dir names versus the copy source in the message","Restage cleanly: mise uninstall <tap>/<token> then mise install <tap>/<token>","Verify the cask's declared version matches the payload layout used by the source template","If the upstream metadata points at a file the archive never ships, report it to homebrew-cask"],"exampleFix":"# before: interrupted install left a partial staged tree\nls \"$(brew --caskroom)/<token>/<version>\"   # expected payload missing\n# after: restage and reinstall\nmise uninstall <tap>/<token> && mise install <tap>/<token>","handlingStrategy":"validation","validationCode":"STAGED=\"$(brew --caskroom)/<token>/<version>\"\ntest -e \"$STAGED/<expected-source>\" || echo \"copy source missing - restage (mise uninstall && mise install)\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Let mise fully uninstall before reinstalling so staging is never partial","Verify {{version}}-templated sources against the actual payload layout after cask upgrades","Treat any interrupted install as requiring a clean restage"],"tags":["brew","cask","copy","staging","template","file-not-found"],"backgroundTag":"file-not-found","analyzedSha":"9dcfcaa0dc8747a2577d3270b69bb9d8313b2807","analyzedAt":"2026-08-17T14:28:50.624Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}