{"record":{"id":"d432ab6aafa8a152","repo":"jdx/mise","slug":"brew-cask-binary-artifact-was-not-staged-d432ab","errorCode":null,"errorMessage":"brew-cask: binary artifact '{}' was not staged","messagePattern":"brew-cask: binary artifact '(.+?)' was not staged","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/packages/brew/cask/mod.rs","lineNumber":3709,"sourceCode":"    }\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\nfn link_command_wrapper(caskroom: &Path, wrapper: &CommandWrapperArtifact) -> Result<()> {\n    let source = wrapper.caskroom_path(caskroom);\n    if !source.is_file() {\n        bail!(\n            \"brew-cask: command wrapper '{}' was not staged\",\n            wrapper.name","sourceCodeStart":3691,"sourceCodeEnd":3727,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/packages/brew/cask/mod.rs#L3691-L3727","documentation":"This is the fallback branch of the same binary verification: if the caskroom binary path is neither a regular file nor a dangling symlink (i.e. it does not exist at all), the library bails reporting that the binary artifact declared by the cask was never staged. The cask metadata promises a binary at 'binary.source' but staging did not produce it.","triggerScenarios":"Installing a cask whose binary stanza references 'binary.source' that was not produced by the staging step — the caskroom path has no symlink_metadata at all. E.g. the payload archive lacked the declared artifact or staging skipped it (see error 1210's 'continue' skip path).","commonSituations":"Cask stanza lists a binary that the upstream payload no longer ships; a cask version upgrade renamed the artifact; staging skipped the payload due to a rejected/relative-path mismatch, leaving the target absent.","solutions":["Verify the cask's binary.source matches an artifact actually present in the staged payload; correct the source path if the upstream renamed it","Check whether staging skipped the payload (e.g. path-rejection logs) and fix the underlying staging failure first","Reinstall the cask at a version whose payload contains the declared binary","Clear cask caches/staging dirs and retry to rule out a stale partial install"],"exampleFix":"// before: stanza references an artifact that no longer exists in the payload\nBinary { source: \"MyApp-old.app/Contents/MacOS/app\", .. }\n// after\nBinary { source: \"MyApp.app/Contents/MacOS/app\", .. }","handlingStrategy":"validation","validationCode":"fn staged_binary_present(caskroom_bin: &Path) -> bool {\n    caskroom_bin.symlink_metadata().is_ok()\n}\n// confirm the declared binary.source exists in the staged payload before install","typeGuard":null,"tryCatchPattern":"match install_result {\n    Err(e) if e.to_string().contains(\"was not staged\") => {\n        // inspect the cask stanza's binary.source vs the staged payload\n    }\n    r => r?,\n}","preventionTips":["Keep binary.source paths in sync with the upstream payload layout when bumping cask versions","Check staging logs for skipped/rejected payloads before installing binaries","Clear stale staging directories after failed installs"],"tags":["brew","cask","missing-file","staging"],"backgroundTag":"file-not-found","analyzedSha":"533346cc374382b41ec5ff70536252b2e96e725c","analyzedAt":"2026-09-17T13:35:38.149Z","contentChangedAt":"2026-09-17T13:35:38.149Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}