{"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":2649,"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":2631,"sourceCodeEnd":2667,"githubUrl":"https://github.com/jdx/mise/blob/9dcfcaa0dc8747a2577d3270b69bb9d8313b2807/src/system/packages/brew/cask.rs#L2631-L2667","documentation":"Font installation is two-phase: an earlier step copies the font file into the Caskroom, then link_font copies it into the user font directory. link_font requires the staged Caskroom file to exist as a regular file; if it does not, the staging phase did not produce the expected file at the expected name.","triggerScenarios":"font.source in the cask not matching the file actually extracted (renamed upstream, case difference, nested path); the copy/staging step skipped or failed; caskroom path computed with a different filename between the two phases.","commonSituations":"Upstream releases renaming font files; stale or partial installs where the Caskroom copy is absent; casks whose font stanza references a nested or differently-cased path.","solutions":["Inspect the caskroom font directory (see caskroom_font_path) and compare with the font stanza's source","Fix font.source in the cask to the real file name/path","Uninstall and reinstall the cask so staging reruns cleanly"],"exampleFix":"# before -- upstream renamed the file\nfont: \"MyFont-Regular.otf\"\n\n# after\nfont: \"MyFont-Regular.ttf\"","handlingStrategy":"validation","validationCode":"let staged = caskroom_font_path(caskroom, font)?;\nif !staged.is_file() {\n    anyhow::bail!(\n        \"font '{}' not staged into caskroom; run the copy step first (found: {:?})\",\n        font.source,\n        staged.exists()\n    );\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Match font.source exactly (case and extension) with the extracted artifact","Reinstall the cask after upstream renames font files","Treat repeated staging misses as a signal the cask stanza is stale"],"tags":["brew-cask","font","staging","file-not-found"],"backgroundTag":"file-not-found","analyzedSha":"9dcfcaa0dc8747a2577d3270b69bb9d8313b2807","analyzedAt":"2026-08-17T14:28:50.624Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}