{"record":{"id":"1defda1f6622c1f9","repo":"jdx/mise","slug":"brew-cask-completion-artifact-was-not-staged","errorCode":null,"errorMessage":"brew-cask: completion artifact '{}' was not staged","messagePattern":"brew-cask: completion artifact '(.+?)' was not staged","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/packages/brew/cask.rs","lineNumber":4124,"sourceCode":"        let caskroom_completion = caskroom_completion_path(caskroom, &target)?;\n        if let Some(parent) = caskroom_completion.parent() {\n            file::create_dir_all(parent)?;\n        }\n        let output = generate_completion_output(&executable, completion, *shell)?;\n        crate::file::write(caskroom_completion, output)?;\n    }\n    Ok(())\n}\n\nfn link_completion(\n    cask: &Cask,\n    artifacts: &CaskArtifacts,\n    caskroom: &Path,\n    target: &Path,\n) -> Result<()> {\n    let caskroom_completion = caskroom_completion_path(caskroom, target)?;\n    if !caskroom_completion.is_file() {\n        bail!(\n            \"brew-cask: completion artifact '{}' was not staged\",\n            target.display()\n        );\n    }\n    if let Some(parent) = target.parent() {\n        create_dir_all_elevating(parent)?;\n    }\n    ensure_completion_target_replaceable(cask, artifacts, target)?;\n    make_symlink_elevating(&caskroom_completion, target)?;\n    Ok(())\n}\n\nfn ensure_completion_target_replaceable(\n    cask: &Cask,\n    artifacts: &CaskArtifacts,\n    target: &Path,\n) -> Result<()> {\n    let Ok(metadata) = target.symlink_metadata() else {","sourceCodeStart":4106,"sourceCodeEnd":4142,"githubUrl":"https://github.com/jdx/mise/blob/6f52dcdf99e282ef7a7db68c81301fa4618d0f79/src/system/packages/brew/cask.rs#L4106-L4142","documentation":"While linking shell completions, the expected completion file is missing from the caskroom: `caskroom_completion_path` derives where the completion should have been staged, and `!is_file()` there aborts before the target symlink is created. Earlier artifact steps are expected to have moved or copied the file into the caskroom first.","triggerScenarios":"A `completion` artifact whose source file was never placed into the caskroom (a preceding move/copy step failed for it, the payload renamed the file, or the app bundle lacks it); a stale partial caskroom left by an interrupted install.","commonSituations":"Upstream app dropped or renamed its completion file between releases; an install retried after interrupted staging; a completion source path typo in the cask definition.","solutions":["Inspect the cask's caskroom directory and confirm the completion file is staged where the artifact expects it","Fix the completion artifact's source, or the preceding move/copy steps, so the file lands in the caskroom","Remove the cask's caskroom directory and reinstall to eliminate partial staging","If the completion is generated rather than shipped, use the generated-completions artifact instead of a staged file"],"exampleFix":"# before\ncompletion(source: \"#{appdir}/MyApp.app/Contents/Resources/_myapp\", target: \"#{data}/zsh/site-functions/_myapp\")\n# after - a move step stages the file into the caskroom first\nmove(source: \"MyApp.app/Contents/Resources/_myapp\", target: \"completions/_myapp\")\ncompletion(source: \"completions/_myapp\", target: \"#{data}/zsh/site-functions/_myapp\")","handlingStrategy":"fallback","validationCode":"// Before linking completions, confirm the artifact was actually staged\nlet caskroom_completion = caskroom_completion_path(caskroom, target)?;\nif !caskroom_completion.is_file() {\n    // choose: skip completion linking (install continues) or fail with context\n    warn!(\"completion '{}' not staged; skipping\", target.display());\n    return Ok(());\n}","typeGuard":null,"tryCatchPattern":"if err.to_string().contains(\"completion artifact\") && err.to_string().contains(\"was not staged\") {\n    // degrade gracefully: finish the install without completions and queue a re-stage\n}","preventionTips":["Order artifact steps so the completion file is moved/copied into the caskroom before linking","Use generated-completions for tools that emit completions at runtime","Wipe the caskroom on interrupted installs to avoid partial staging"],"tags":["brew-cask","completion","missing-file","install-artifact"],"backgroundTag":"artifact-not-staged","analyzedSha":"6f52dcdf99e282ef7a7db68c81301fa4618d0f79","analyzedAt":"2026-08-22T10:14:23.840Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}