{"record":{"id":"fc92df665a07e316","repo":"jdx/mise","slug":"brew-cask-completion-artifact-was-not-staged-fc92df","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/mod.rs","lineNumber":2883,"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":2865,"sourceCodeEnd":2901,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/packages/brew/cask/mod.rs#L2865-L2901","documentation":"After a cask's completion (symlink/link) artifact is staged into the caskroom, mise links it to its final target. Before linking it calls caskroom_completion_path and checks that the staged file actually exists in the caskroom. If the staged artifact is missing, it bails rather than silently creating a dangling link, indicating the staging step did not produce the expected artifact.","triggerScenarios":"Installing a cask whose artifacts declare a completion target, but the expected staged file at caskroom_completion_path(caskroom, target) does not exist as a file — staging was skipped, partially failed, or the artifact source name doesn't match what was staged.","commonSituations":"Interrupted or partially completed cask install left the caskroom incomplete; a cask definition expects an artifact the installer never staged (upstream cask changed artifact layout); manual deletion of caskroom contents; version directory mismatch after an upgrade.","solutions":["Re-run the cask install so staging completes and the artifact is present in the caskroom.","Remove the incomplete caskroom version directory (`mise uninstall` then reinstall the cask).","Check the cask's artifact definition: the staged completion source must match what the install stages.","Verify disk space/permissions on the caskroom path so staging isn't silently failing."],"exampleFix":"// before: installing on top of a partially staged caskroom\nmise install cask://my-font\n\n// after: clear the incomplete staging first, then reinstall\nmise uninstall cask://my-font && mise install cask://my-font","handlingStrategy":"validation","validationCode":"use std::path::Path;\nfn staged_artifact_present(caskroom: &Path, target: &Path) -> bool {\n    caskroom_completion_path(caskroom, target)\n        .map(|p| p.is_file())\n        .unwrap_or(false)\n}\n// check before invoking the completion/link step","typeGuard":null,"tryCatchPattern":"// Rust\nmatch install_cask_completion(&cask, &artifacts, &caskroom, &target) {\n    Err(e) if e.to_string().contains(\"was not staged\") => {\n        // clean the caskroom version dir and retry the install once\n    }\n    Ok(()) => {}\n    Err(e) => return Err(e),\n}","preventionTips":["Avoid interrupting cask installs mid-staging; reinstall after a killed run.","Verify the caskroom version directory contains expected artifacts before linking.","Keep cask definitions in sync with upstream artifact layouts.","Check disk space and caskroom permissions before installing."],"tags":["brew-cask","staging","missing-artifact","install"],"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"}