{"record":{"id":"35b96e46bd80a89a","repo":"jdx/mise","slug":"files-cannot-unapply-these-entries","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":2326,"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":2308,"sourceCodeEnd":2344,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/system/files.rs#L2308-L2344","documentation":"Aggregate error from building an unapply plan: some `[files]` entries could not be planned for removal, and their per-entry errors (prefixed with the entry's target_raw key) are listed under a common header. Nothing from the failing entries is unapplied.","triggerScenarios":"Calling files unapply when planning a removal for an entry fails — e.g. the source is gone, the Git repo is missing, or the target cannot be matched back to a managed plan (Ok(None)/Err paths in per-entry planning).","commonSituations":"User deleted the dotfiles repo but left the config entry; source/target paths changed; entries referencing stale targets from an old configuration.","solutions":["Fix each listed `[files].\"target\"` entry per its embedded error (restore the source/repo or correct paths).","Remove obsolete [[files]] entries from mise.toml if they should no longer be managed.","Re-run unapply once all listed entries plan successfully."],"exampleFix":"// before (mise.toml)\n[[files]]\nsource = \"~/old-dotfiles/zshrc\"  # repo deleted\ntarget = \"~/.zshrc\"\n\n// after\n# remove the stale entry or repoint source:\n[[files]]\nsource = \"~/dotfiles/zshrc\"\ntarget = \"~/.zshrc\"","handlingStrategy":"validation","validationCode":"fn ensure_unapply_targets_managed(config: &toml::Value) -> anyhow::Result<()> {\n    // every [[files]] entry must still have an existing source repo and a target that is a symlink or absent\n    for entry in files_entries(config) {\n        let target = std::path::Path::new(&expand(&entry.target));\n        if target.exists() && !target.is_symlink() && target.is_file() {\n            anyhow::bail!(\"target {} is a regular file; not a managed symlink\", entry.target);\n        }\n    }\n    Ok(())\n}","typeGuard":null,"tryCatchPattern":"match result {\n    Err(e) if e.to_string().contains(\"cannot unapply these entries\") => {\n        eprintln!(\"Unapply blocked; fix or drop the listed [files] entries:\\n{e}\");\n    }\n    Err(e) => return Err(e),\n    Ok(todo) => unapply(todo),\n}","preventionTips":["Keep the dotfiles repo intact as long as [[files]] entries reference it.","Prune stale [[files]] entries whenever you remove dotfiles.","Snapshot targets before unapplying so mistakes are recoverable."],"tags":["dotfiles","unapply","config"],"backgroundTag":"invalid-state-transition","analyzedSha":"afd2eddd3a50c16190efc1c7e94404b48f72af57","analyzedAt":"2026-09-09T01:38:25.179Z","contentChangedAt":"2026-09-09T01:38:25.179Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}