jdx/mise · error · eyre::Report

cannot verify {}; use --force to remove it

Error message

cannot verify {}; use --force to remove it

What it means

While walking directory-backed entries, mise removes a target child only when it can compare it with the matching source item. If the target exists but the source item is not a readable regular file (deleted from the repo, replaced by a directory, or a broken symlink — `is_file()` follows links), ownership cannot be verified and `--force` is required.

Source

Thrown at src/system/files.rs:1678

    Ok(())
}

fn plan_regular_file(
    source: &Path,
    target: &Path,
    force: bool,
    paths: &mut IndexMap<PathBuf, ()>,
) -> Result<()> {
    if !target.exists() && !target.is_symlink() {
        return Ok(());
    }
    if source.is_file() {
        plan_expected_content(&file::read(source)?, target, force, paths)
    } else if force {
        paths.insert(target.to_path_buf(), ());
        Ok(())
    } else {
        bail!(
            "cannot verify {}; use --force to remove it",
            target.display_user()
        )
    }
}

fn plan_expected_content(
    expected: &[u8],
    target: &Path,
    force: bool,
    paths: &mut IndexMap<PathBuf, ()>,
) -> Result<()> {
    if force || (target.is_file() && !target.is_symlink() && file::read(target)? == expected) {
        paths.insert(target.to_path_buf(), ());
        Ok(())
    } else {
        bail!(
            "{} differs from its managed source; use --force to remove it",

View on GitHub (pinned to 6f52dcdf99)

Solutions

  1. Restore the missing source items (`git checkout -- <dir>`), then unapply
  2. Use `--force` to remove the unverifiable targets
  3. Clean stale entries out of the source tree so apply/unapply stay symmetric

Example fix

# before: a file was dropped from the source dir after apply
$ git -C ~/dotfiles log --oneline -1 -- nvim/lua.lua   # deleted in a cleanup commit
$ mise bootstrap dotfiles unapply
Error: cannot verify ~/.config/nvim/lua.lua; use --force to remove it

# after: restore it, then unapply verifies the child
$ git -C ~/dotfiles checkout HEAD~1 -- nvim/lua.lua
$ mise bootstrap dotfiles unapply
Defensive patterns

Strategy: validation

Validate before calling

# Every tracked file under directory sources must exist on disk.
cd ~/dotfiles && git status --porcelain | grep '^.D' && { echo 'deleted sources present'; exit 1; } || true

Type guard

fn is_unverifiable_child(err: &miette::Report) -> bool {
    err.to_string().starts_with("cannot verify")
        && err.to_string().contains("use --force to remove it")
}

Prevention

When it happens

Trigger: `plan_regular_file` invoked with a (source, target) pair from `walk_source_files` (copy / symlink-each directory modes) or `plan_single_file`, where the target exists, `source.is_file()` is false, and force is false.

Common situations: Files were removed from the dotfiles source dir after apply but their copied children remain; a source item became a directory; a broken symlink sits in the source tree.

Related errors


AI-assisted analysis of jdx/mise@6f52dcdf99 (2026-08-22). Data as JSON: /api/errors/0dd13155efdd6f64. Report an issue: GitHub.