{"record":{"id":"55678d913e2a8c99","repo":"jdx/mise","slug":"brew-cask-command-wrapper-was-not-staged-55678d","errorCode":null,"errorMessage":"brew-cask: command wrapper '{}' was not staged","messagePattern":"brew-cask: command wrapper '(.+?)' was not staged","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/packages/brew/cask/mod.rs","lineNumber":3725,"sourceCode":"            );\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\n        );\n    }\n    let target = wrapper.target_path()?;\n    if let Some(parent) = target.parent() {\n        create_dir_all_elevating(parent)?;\n    }\n    make_symlink_elevating(&source, &target)?;\n    Ok(())\n}\n\nfn caskroom_binary_path(\n    caskroom: &Path,\n    appdir: &Path,\n    binary: &BinaryArtifact,\n) -> Result<PathBuf> {\n    let target = binary.target_path(appdir)?;","sourceCodeStart":3707,"sourceCodeEnd":3743,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/packages/brew/cask/mod.rs#L3707-L3743","documentation":"This error is thrown by `link_command_wrapper` when linking a brew-cask command wrapper artifact: the wrapper file that should have been staged inside the caskroom (`wrapper.caskroom_path(caskroom)`) does not exist as a file at link time. The staging and linking steps are separated, so this invariant failure means the staged artifact went missing or was never produced before linking.","triggerScenarios":"Calling the cask install/link pipeline where `CommandWrapperArtifact::caskroom_path(caskroom)` returns a path that is not an existing file — i.e., the wrapper was never staged, was deleted between staging and linking, or the caskroom path was computed differently in the two phases.","commonSituations":"A partially-failed prior install left the caskroom without the staged wrapper; a concurrent process cleaned the caskroom; a cask definition names a command wrapper that the staging step skipped; or a mise version change altered wrapper naming so the link step looks for the old staged filename.","solutions":["Re-run the cask install so staging and linking happen together: `mise use` / re-install the affected cask.","Clear the cask's partial state (remove its caskroom directory) and reinstall from scratch.","Check for concurrent mise/homebrew processes that could clean the caskroom mid-install and run installs serially.","If it persists, verify the cask's command-wrapper definition and check for a recent mise version change to wrapper staging paths; report if the mismatch is internal."],"exampleFix":"// before (stale/partial caskroom state)\nrm -rf \"$(brew --prefix)/Caskroom/mytool\"\nmise install  # restage and relink\n\n// after: staging and link run in one pass, wrapper found\n# install completes without 'command wrapper ... was not staged'","handlingStrategy":"try-catch","validationCode":"let staged = wrapper.caskroom_path(&caskroom);\nif !staged.is_file() {\n    eprintln!(\"wrapper not staged: {}\", staged.display());\n}","typeGuard":"fn is_staged(wrapper: &CommandWrapperArtifact, caskroom: &Path) -> bool {\n    wrapper.caskroom_path(caskroom).is_file()\n}","tryCatchPattern":"match link_command_wrapper(&caskroom, &wrapper) {\n    Err(e) if e.to_string().contains(\"was not staged\") => {\n        // restage: reinstall the cask, then retry the link\n    }\n    other => other?,\n}","preventionTips":["Always run staging and linking as one install pass; never link manually from a stale caskroom.","Avoid concurrent mise/homebrew operations touching the same caskroom.","After a failed install, clear the cask's caskroom directory before retrying."],"tags":["brew-cask","filesystem","install","missing-artifact"],"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"}