{"record":{"id":"3dfd488b7dba640f","repo":"jdx/mise","slug":"files-cannot-unapply-these-entries-n","errorCode":null,"errorMessage":"files: cannot unapply these entries:\\n{}","messagePattern":"files: cannot unapply these entries:\\\\n(.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/files.rs","lineNumber":1384,"sourceCode":"/// Remove configured whole-file entries without recursively deleting\n/// directories that may contain unmanaged files. Symlinks carry their own\n/// ownership evidence. Copies and templates must still match their source\n/// unless `--force` was given.\npub(crate) fn plan_unapply<'a>(\n    requests: &'a [FileRequest],\n    opts: &UnapplyOpts,\n) -> Result<Vec<UnapplyPlan<'a>>> {\n    let mut todo = vec![];\n    let mut problems = vec![];\n    for req in requests {\n        match plan_unapply_one(req, opts) {\n            Ok(Some(plan)) => todo.push(plan),\n            Ok(None) => {}\n            Err(err) => problems.push(format!(\"  [dotfiles].\\\"{}\\\": {err}\", req.target_raw)),\n        }\n    }\n    if !problems.is_empty() {\n        bail!(\n            \"files: cannot unapply these entries:\\n{}\",\n            problems.join(\"\\n\")\n        );\n    }\n    Ok(todo)\n}\n\n/// Resolve checks that may execute user-authored template functions. This runs\n/// only after interactive confirmation, but still before any mutation.\npub(crate) fn resolve_unapply(\n    config: &Config,\n    plans: &mut Vec<UnapplyPlan<'_>>,\n    opts: &UnapplyOpts,\n) -> Result<()> {\n    if opts.dry_run {\n        return Ok(());\n    }\n    let mut problems = vec![];","sourceCodeStart":1366,"sourceCodeEnd":1402,"githubUrl":"https://github.com/jdx/mise/blob/6f52dcdf99e282ef7a7db68c81301fa4618d0f79/src/system/files.rs#L1366-L1402","documentation":"Thrown by `mise bootstrap dotfiles unapply` during the first, render-free planning pass over `[dotfiles]` entries. Every entry is planned before anything is deleted; each entry that cannot be verified as mise-owned (drifted content, missing source, foreign symlink, wrong file type) is collected into one aggregate error with a `[dotfiles].\"<target>\": <reason>` line per failure. The command is all-or-nothing: when this fires, nothing has been removed.","triggerScenarios":"Running `mise bootstrap dotfiles unapply` (optionally with target filters) when at least one entry fails `plan_unapply_one`: a copy/template target whose bytes differ from its source, a symlink pointing somewhere other than the configured source, a source file deleted from the dotfiles repo, or a non-directory target for a directory-backed mode.","commonSituations":"Hand-editing a managed file after apply; renaming/moving the dotfiles source without re-applying; switching an entry's mode (copy->symlink) so the on-disk target no longer matches; another dotfile manager (stow, home-manager) having replaced targets.","solutions":["Read each `  [dotfiles].\"<target>\": <reason>` line and fix that specific entry: restore the missing source or run `mise bootstrap dotfiles apply` so targets match again","Re-check after each fix with `mise bootstrap dotfiles unapply --dry-run` (inert, shows the remaining failures)","If the drifted targets are disposable, re-run with `--force` to skip ownership verification","Delete `[dotfiles]` entries you no longer manage so unapply stops planning them"],"exampleFix":"# before: source was deleted from the dotfiles repo\n$ rm ~/dotfiles/zshrc\n$ mise bootstrap dotfiles unapply\nError: files: cannot unapply these entries:\n  [dotfiles].\"~/.zshrc\": source is missing; use --force to remove the target\n\n# after: restore the source, verify with dry-run, then unapply\n$ git -C ~/dotfiles checkout -- zshrc\n$ mise bootstrap dotfiles unapply --dry-run\n$ mise bootstrap dotfiles unapply","handlingStrategy":"validation","validationCode":"#!/usr/bin/env bash\n# Gate the real unapply on an inert dry-run so failures surface before\n# anything is at risk (run in CI or before manual runs).\nset -euo pipefail\nif ! mise bootstrap dotfiles unapply --dry-run; then\n  echo \"unapply plan failed; fix the entries above or pass --force deliberately\" >&2\n  exit 1\nfi\nmise bootstrap dotfiles unapply --yes","typeGuard":"// Rust (embedding mise internals): detect this aggregate bail.\nfn is_unapply_plan_refused(err: &miette::Report) -> bool {\n    err.to_string()\n        .starts_with(\"files: cannot unapply these entries\")\n}","tryCatchPattern":"// Rust: treat planning failure as a hard stop; nothing was mutated,\n// so report and re-run after fixing entries (never ignore).\nmatch files::plan_unapply(&reqs, &opts) {\n    Ok(plans) => { /* proceed to resolve/execute */ }\n    Err(err) if is_unapply_plan_refused(&err) => {\n        eprintln!(\"{err:?}\");\n        std::process::exit(1);\n    }\n    Err(err) => return Err(err),\n}","preventionTips":["Keep the dotfiles source repo under version control so any deleted/renamed source is one `git checkout` away","Never hand-edit a mise-managed target; edit the source and re-apply","After changing modes or paths in `[dotfiles]`, run `mise bootstrap dotfiles apply` before ever unapplying","Script unapply as `--dry-run` first, real run second"],"tags":["mise","dotfiles","unapply","all-or-nothing","aggregate-error"],"backgroundTag":"dotfiles-unapply-refused","analyzedSha":"6f52dcdf99e282ef7a7db68c81301fa4618d0f79","analyzedAt":"2026-08-22T10:14:23.840Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T20:17:18.057Z"}