{"record":{"id":"0dd13155efdd6f64","repo":"jdx/mise","slug":"cannot-verify-use-force-to-remove-it","errorCode":null,"errorMessage":"cannot verify {}; use --force to remove it","messagePattern":"cannot verify (.+?); use --force to remove it","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/files.rs","lineNumber":2898,"sourceCode":"    Ok(())\n}\n\nfn plan_regular_file(\n    source: &Path,\n    target: &Path,\n    force: bool,\n    paths: &mut IndexMap<PathBuf, ()>,\n) -> Result<()> {\n    if !target.exists() && !target.is_symlink() {\n        return Ok(());\n    }\n    if source.is_file() {\n        plan_expected_content(&file::read(source)?, target, force, paths)\n    } else if force {\n        paths.insert(target.to_path_buf(), ());\n        Ok(())\n    } else {\n        bail!(\n            \"cannot verify {}; use --force to remove it\",\n            target.display_user()\n        )\n    }\n}\n\nfn plan_expected_content(\n    expected: &[u8],\n    target: &Path,\n    force: bool,\n    paths: &mut IndexMap<PathBuf, ()>,\n) -> Result<()> {\n    if force || (target.is_file() && !target.is_symlink() && file::read(target)? == expected) {\n        paths.insert(target.to_path_buf(), ());\n        Ok(())\n    } else {\n        bail!(\n            \"{} differs from its managed source; use --force to remove it\",","sourceCodeStart":2880,"sourceCodeEnd":2916,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/files.rs#L2880-L2916","documentation":"`plan_expected_content` for a directory-source entry: if the source entry is not a regular file, mise has no content to compare against, and the only safe path is an explicit `--force` (remove without verification). Without `--force` it bails, naming the target, because it cannot prove the target is mise-managed.","triggerScenarios":"Unapply planning of an entry whose source is a directory/symlink/special file (not `is_file()`), `force` is false, and the target exists — e.g. symlink-each enumerating an entry backed by a non-regular file.","commonSituations":"A source entry became a symlink or directory after being applied (type changed on disk or in git), so the content-verification path no longer applies during unapply.","solutions":["Re-run unapply with `--force` to remove the unverifiable target","Restore the source entry to a regular file so its content can be compared","Manually inspect and remove the target if unsure"],"exampleFix":"// before\n$ mise files unapply\nerror: cannot verify /home/u/.config/foo; use --force to remove it\n\n// after\n$ mise files unapply --force","handlingStrategy":"validation","validationCode":"if !source.is_file() {\n    warn(`source '${source}' is not a regular file; removal cannot be verified, --force required`);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep managed sources as regular files","Avoid changing a source file's type (file -> symlink/dir) while applied","Unapply before restructuring the dotfiles repo"],"tags":["dotfiles","verification","safety-guard"],"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"}