jdx/mise · error

files: cannot unapply these entries

Error message

files: cannot unapply these entries:
{}

What it means

Aggregate error from `plan_unapply`, the first (pre-confirmation) planning pass of `mise dot unapply`. Each configured entry is inspected to decide which paths are safely removable; any entry whose planning fails (e.g. the target symlink points elsewhere, target is not the managed file, source directory missing) is collected and reported together, and no removal happens.

Solutions

  1. Inspect each listed `[dotfiles]."<target>"` entry manually to see what its target now contains.
  2. If the target is intentionally yours (not mise-managed), re-run with `mise dot unapply --force` to remove it anyway.
  3. Restore the missing source directory (e.g. re-clone the dotfiles repo) so Copy-mode children can be identified.
  4. Remove the stale entry from the `[dotfiles]` config if it is no longer wanted.

Example fix

// before
mise dot unapply
// files: cannot unapply these entries:
//   [dotfiles]."~/.vimrc": target symlink points to /etc/vimrc, use --force...
// after
mise dot unapply --force   # only after confirming /etc/vimrc replacement is OK
Defensive patterns

Strategy: try-catch

Validate before calling

for each [dotfiles] entry: test -e <source> && readlink <target>  # confirm target is still the managed symlink

Try / catch

// Rust/eyre caller pattern
match plan_unapply(&requests, &opts) {
    Err(e) if e.to_string().starts_with("files: cannot unapply these entries:") => {
        // inspect listed entries; decide on --force or manual cleanup
    }
    r => r?,
}

Prevention

When it happens

Trigger: `mise dot unapply` where one or more entries fail `plan_unapply_one`: target symlink points at a different destination, target exists but is not the managed symlink/directory, or (Copy mode) the source directory is missing so managed children cannot be identified.

Common situations: The user replaced a managed dotfile with their own file or pointed the symlink somewhere else; the dotfiles source repo was deleted before unapplying; a mode was changed in config after applying (symlink -> copy) leaving the target in the old shape.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17). Data as JSON: /api/errors/35b96e46bd80a89a. Report an issue: GitHub.

Appendix: source

Thrown at src/system/files.rs:2573

/// Remove configured whole-file entries without recursively deleting
/// directories that may contain unmanaged files. Symlinks carry their own
/// ownership evidence. Copies and templates must still match their source
/// unless `--force` was given.
pub(crate) fn plan_unapply<'a>(
    requests: &'a [FileRequest],
    opts: &UnapplyOpts,
) -> Result<Vec<UnapplyPlan<'a>>> {
    let mut todo = vec![];
    let mut problems = vec![];
    for req in requests {
        match plan_unapply_one(req, opts) {
            Ok(Some(plan)) => todo.push(plan),
            Ok(None) => {}
            Err(err) => problems.push(format!("  [dotfiles].\"{}\": {err}", req.target_raw)),
        }
    }
    if !problems.is_empty() {
        bail!(
            "files: cannot unapply these entries:\n{}",
            problems.join("\n")
        );
    }
    Ok(todo)
}

/// Resolve checks that may execute user-authored template functions. This runs
/// only after interactive confirmation, but still before any mutation.
pub(crate) fn resolve_unapply(
    config: &Config,
    plans: &mut Vec<UnapplyPlan<'_>>,
    opts: &UnapplyOpts,
    secrets: &SecretValues,
) -> Result<()> {
    if opts.dry_run {
        return Ok(());
    }

View on GitHub (pinned to 533346cc37)