{"record":{"id":"4a06a0aff06433ea","repo":"jdx/mise","slug":"brew-cask-structured-symlink-source-did-not","errorCode":null,"errorMessage":"brew-cask: structured symlink source '{}' did not match any paths","messagePattern":"brew-cask: structured symlink source '(.+?)' did not match any paths","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/packages/brew/cask.rs","lineNumber":3627,"sourceCode":"            force,\n            uninstall,\n            source_glob,\n            sudo,\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 target = resolve_flight_path_with_context(cask, target, staged_path, appdir)?;\n            let sources = flight_symlink_sources(cask, source, *source_glob, staged_path, appdir)?;\n            if sources.is_empty() {\n                bail!(\n                    \"brew-cask: structured symlink source '{}' did not match any paths\",\n                    source.path\n                );\n            }\n            let target_metadata = target.symlink_metadata().ok();\n            let target_is_real_dir = target_metadata\n                .as_ref()\n                .is_some_and(|metadata| metadata.is_dir());\n            let target_is_dir = target_is_real_dir || sources.len() > 1;\n            if sources.len() > 1 {\n                let created_external_directory =\n                    target_metadata.is_none() && !target.starts_with(staged_path);\n                if target_metadata.is_some() && !target_is_real_dir {\n                    if target.exists() && !force && !targets.previous_symlinks.contains(&target) {\n                        bail!(\n                            \"brew-cask: structured symlink target '{}' already exists\",\n                            target.display()\n                        );","sourceCodeStart":3609,"sourceCodeEnd":3645,"githubUrl":"https://github.com/jdx/mise/blob/6f52dcdf99e282ef7a7db68c81301fa4618d0f79/src/system/packages/brew/cask.rs#L3609-L3645","documentation":"A structured `symlink` step found no source paths. Sources resolve through `flight_symlink_sources`: with `source_glob: true` the template-expanded pattern is globbed under the staged path, and an empty result is fatal because a link cannot be created from nothing. All `guards` must have matched for execution to reach this check.","triggerScenarios":"`symlink` with `source_glob: true` matching zero files in the staged payload; a version-stamped source template expanding to a name that no longer exists; the binary was renamed upstream.","commonSituations":"Cask version bump changing binary names; archive layout change between releases; typo or wrong letter-case in the glob.","solutions":["List the staged directory and correct the source pattern to the actual file name","Template the version-dependent segments so the pattern tracks releases","Guard optional symlinks with `if_exists` so absent sources skip instead of fail","Re-stage the payload if extraction may have been partial"],"exampleFix":"# before\nsymlink(source: \"mytool-1.*/bin/mytool\", source_glob: true, target: \"#{prefix}/bin/mytool\")\n# after\nsymlink(source: \"mytool-#{version}/bin/mytool\", source_glob: true, target: \"#{prefix}/bin/mytool\")","handlingStrategy":"validation","validationCode":"// Pre-check symlink glob sources match at least one path\nlet sources = flight_symlink_sources(cask, &step.source, step.source_glob, staged_path, appdir)?;\nif sources.is_empty() {\n    return Err(eyre!(\"symlink source '{}' matched nothing under staged payload\", step.source.path));\n}","typeGuard":null,"tryCatchPattern":"if err.to_string().contains(\"symlink source\") && err.to_string().contains(\"did not match any paths\") {\n    // dump the staged directory tree to pinpoint the renamed file\n}","preventionTips":["Template version-stamped names in symlink sources","Guard optional binaries with `if_exists` so absent sources skip cleanly","Re-test cask stanzas against the new payload before publishing a version bump"],"tags":["brew-cask","symlink","glob","install-artifact"],"backgroundTag":"glob-no-matches","analyzedSha":"6f52dcdf99e282ef7a7db68c81301fa4618d0f79","analyzedAt":"2026-08-22T10:14:23.840Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}