{"record":{"id":"acaa630602329011","repo":"jdx/mise","slug":"brew-cask-binary-artifact-was-staged-but-sym","errorCode":null,"errorMessage":"brew-cask: binary artifact '{}' was staged but symlink target '{}' does not exist","messagePattern":"brew-cask: binary artifact '(.+?)' was staged but symlink target '(.+?)' does not exist","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/packages/brew/cask.rs","lineNumber":4877,"sourceCode":"fn cask_appdir(apps: &[AppArtifact]) -> Result<PathBuf> {\n    let prefix_app_dir = prefix::prefix().join(\"Applications\");\n    for app in apps {\n        if app_target_path(app.target_name())?.starts_with(&prefix_app_dir) {\n            return Ok(prefix_app_dir);\n        }\n    }\n    target_app_dir()\n}\n\nfn link_binary(caskroom: &Path, appdir: &Path, binary: &BinaryArtifact) -> Result<()> {\n    let caskroom_binary = caskroom_binary_path(caskroom, appdir, binary)?;\n    if !caskroom_binary.is_file() {\n        if caskroom_binary\n            .symlink_metadata()\n            .is_ok_and(|metadata| metadata.file_type().is_symlink())\n        {\n            let target = std::fs::read_link(&caskroom_binary)?;\n            bail!(\n                \"brew-cask: binary artifact '{}' was staged but symlink target '{}' does not exist\",\n                binary.source,\n                target.display()\n            );\n        }\n        bail!(\n            \"brew-cask: binary artifact '{}' was not staged\",\n            binary.source\n        );\n    }\n    let target = binary.target_path(appdir)?;\n    if let Some(parent) = target.parent() {\n        create_dir_all_elevating(parent)?;\n    }\n    make_symlink_elevating(&caskroom_binary, &target)?;\n    Ok(())\n}\n","sourceCodeStart":4859,"sourceCodeEnd":4895,"githubUrl":"https://github.com/jdx/mise/blob/6f52dcdf99e282ef7a7db68c81301fa4618d0f79/src/system/packages/brew/cask.rs#L4859-L4895","documentation":"During linking, mise expects each binary artifact to exist as a regular file at its staged caskroom path. Here the path exists as a symlink (symlink_metadata says so) but is_file() is false — the symlink's target does not exist, i.e. the staged payload contains a dangling symlink where a runnable binary was declared. The message reports both the binary stanza source and the (missing) link target.","triggerScenarios":"A cask binary stanza matches a path inside the staged payload that is a symlink whose destination is absent — e.g. an app bundle shipping symlinks to absolute paths like /usr/lib/... that do not exist in this environment, or payload relocation having rewritten the link to a now-invalid location. Read via std::fs::read_link at src/system/packages/brew/cask.rs:4877.","commonSituations":"macOS apps bundling symlinks meant to resolve only on a full macOS install; installing casks on Linux where framework paths differ; partially extracted or interrupted downloads that left broken links; payloads where the binary stanza pointed at a symlink instead of the real executable.","solutions":["Adjust the binary stanza's source to point at the real executable file rather than a symlink (check the error's reported target path to see where the link was supposed to go).","If the symlink target should exist on this machine (e.g. a system library), install that dependency so the link resolves.","Uninstall and reinstall the cask to restage a clean payload — interrupted staging can leave broken links.","Report the cask upstream if the app genuinely ships dangling symlinks in its distribution."],"exampleFix":"# before — stanza points at a symlink whose target is absent\n\"binary\": [\"MyApp.app/Contents/MacOS/tool-link\"]\n\n# after — point at the real binary\n\"binary\": [\"MyApp.app/Contents/MacOS/tool\"]","handlingStrategy":"validation","validationCode":"# after staging, confirm every declared binary resolves to a real file\nfor b in \"$(jq -r '.binaries[].source' meta.json)\"; do\n  P=\"<caskroom>/$b\"\n  [ -f \"$P\" ] || [ -f \"$(readlink -f \"$P\" 2>/dev/null)\" ] || echo \"broken: $P -> $(readlink \"$P\" 2>/dev/null)\"\ndone","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Point binary stanzas at real executables, never at bundled symlinks.","Test casks on a clean machine (or CI) so absolute-path symlinks fail before users see them.","Reinstall to restage whenever an install was interrupted."],"tags":["brew-cask","binary-artifact","symlink","staging","mise"],"backgroundTag":"dangling-symlink","analyzedSha":"6f52dcdf99e282ef7a7db68c81301fa4618d0f79","analyzedAt":"2026-08-22T10:14:23.840Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}