{"record":{"id":"3b0d10b5f6a632da","repo":"jdx/mise","slug":"brew-cask-font-artifact-was-not-staged","errorCode":null,"errorMessage":"brew-cask: font artifact '{}' was not staged","messagePattern":"brew-cask: font artifact '(.+?)' was not staged","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/packages/brew/cask.rs","lineNumber":2775,"sourceCode":"    sudo::run(\"installer\", &args, &[])\n}\n\nfn stage_font(stage: &Path, caskroom: &Path, font: &FontArtifact) -> Result<()> {\n    let caskroom_font = caskroom_font_path(caskroom, font)?;\n    file::remove_all(&caskroom_font)?;\n    if let Some(parent) = caskroom_font.parent() {\n        file::create_dir_all(parent)?;\n    }\n    let source = find_file_artifact(stage, &font.source)\n        .ok_or_else(|| eyre!(\"brew-cask: font artifact '{}' was not found\", font.source))?;\n    copy_cask_artifact(&source, &caskroom_font)?;\n    Ok(())\n}\n\nfn link_font(caskroom: &Path, font: &FontArtifact) -> Result<()> {\n    let caskroom_font = caskroom_font_path(caskroom, font)?;\n    if !caskroom_font.is_file() {\n        bail!(\"brew-cask: font artifact '{}' was not staged\", font.source);\n    }\n    let target = font_target_path(font)?;\n    if let Some(parent) = target.parent() {\n        file::create_dir_all(parent)?;\n    }\n    // Atomic swap: rename existing font aside before copying the new one so\n    // that a failure during copy leaves the old font intact.\n    let old_target = target.with_extension(format!(\n        \"mise-old-{}\",\n        crate::hash::hash_to_str(&target.display().to_string())\n    ));\n    file::remove_all(&old_target)?;\n    if target.exists() {\n        file::rename(&target, &old_target)?;\n    }\n    if let Err(e) = copy_cask_artifact(&caskroom_font, &target) {\n        if old_target.exists() {\n            let _ = file::rename(&old_target, &target);","sourceCodeStart":2757,"sourceCodeEnd":2793,"githubUrl":"https://github.com/jdx/mise/blob/6f52dcdf99e282ef7a7db68c81301fa4618d0f79/src/system/packages/brew/cask.rs#L2757-L2793","documentation":"link_font runs after stage_font should have copied the font into the caskroom. It requires caskroom_font.is_file() before performing the atomic swap into the user font directory (rename the old target aside, copy the new one in). If the caskroom path is missing or not a regular file at link time, it bails with the cask's font source name — protecting the swap from operating on nothing.","triggerScenarios":"stage_font never ran or its output vanished (caskroom cleaned mid-install); the font source resolved to a directory or symlink rather than a regular file; caskroom_font_path computed a different location than stage_font wrote (e.g. changed font target between staging and linking).","commonSituations":"Interrupted installs leaving partial caskroom state; cask font stanza pointing at a directory inside the archive; font archives with unexpected layouts.","solutions":["Uninstall the cask (or delete its caskroom version directory) and reinstall so stage_font runs cleanly end-to-end","Verify the cask font source names an actual font file inside the archive","Check the caskroom path from the error for a directory or symlink where the font should be, and clear it","Re-run with MISE_DEBUG=1 to confirm whether stage_font executed at all"],"exampleFix":"# before: partial caskroom state\n$ mise brew install --cask font-x   # link_font fails\n\n# after\n$ mise brew uninstall --cask font-x && mise brew install --cask font-x","handlingStrategy":"validation","validationCode":"// After staging fonts, assert each caskroom font is a regular file before linking.\nfor font in &cask.artifacts.fonts {\n    let staged = caskroom_font_path(caskroom, font)?;\n    if !staged.is_file() {\n        return Err(eyre!(\"font '{}' not staged\", font.source));\n    }\n}","typeGuard":"fn staged_font_is_file(caskroom: &Path, font: &FontArtifact) -> bool {\n    caskroom_font_path(caskroom, font).map(|p| p.is_file()).unwrap_or(false)\n}","tryCatchPattern":null,"preventionTips":["Point font stanzas at real font files in the archive, never directories","Reinstall the cask cleanly after any interrupted install instead of forcing a re-link","Treat a missing staged font as a signal of partial caskroom state"],"tags":["brew-cask","font","staging","file-not-found"],"backgroundTag":"missing-staged-file","analyzedSha":"6f52dcdf99e282ef7a7db68c81301fa4618d0f79","analyzedAt":"2026-08-22T10:14:23.840Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}