jdx/mise · error
edits: cannot unapply these entries
Error message
edits: cannot unapply these entries:
{} What it means
This error is thrown by `plan_unapply` in the edits module when computing the plan to remove managed edit blocks/lines from files. Before modifying anything, it collects per-entry problems (e.g. the edit markers cannot be found, the file diverged from what was recorded, or the entry cannot be reversed), and if any problems exist it refuses to proceed, listing them. It is a safety mechanism so an unapply never partially or incorrectly rewrites files.
Solutions
- Read the problem list included in the error message; each line names the entry and reason.
- Manually fix or restore the marker blocks/lines in the named files so they match what was applied.
- If the file should no longer be managed, remove the corresponding edit entry from the configuration instead of unapplying it.
- Re-run the unapply command after the files are consistent; the planner should then produce a valid todo list.
Example fix
// before: file's managed block markers were hand-deleted // [managed-block id=x] some content // after: restore the exact markers so unapply can locate them // [managed-block id=x] some content // [/managed-block id=x]
Defensive patterns
Strategy: validation
Validate before calling
for entry in edit_entries {
if !file_contains_markers(&entry.path, &entry.id) {
eprintln!("entry {} markers missing or changed in {}", entry.id, entry.path.display());
}
}
// only run unapply when all entries check out Try / catch
match tool.unapply() {
Err(e) if e.to_string().contains("cannot unapply these entries") => {
// parse problem list, fix files, retry
}
other => other?,
} Prevention
- Never hand-edit files containing managed markers.
- Exclude managed files from formatters/watchers that rewrite comments.
- Keep entry ids stable; renaming ids orphans existing markers.
When it happens
Trigger: Calling the unapply flow (plan_unapply) for edit entries whose managed markers/blocks or recorded line state are absent, ambiguous, or changed in the target files, so the plan stage records problems instead of producing a todo list.
Common situations: A user manually edited a file managed by edits and removed/altered comment markers; the recorded edit entry no longer matches the file (tool version upgrade changed comment style or marker wording); two entries collide on overlapping regions; the file was regenerated by a formatter that dropped the markers.
Understand the failure class
Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.
Related errors
- [dotfiles]." / ": block content may not contain its own…
- a provided source resolves to a path
- additional asset ' ' is not an archive
- agent ' ' `start_calendar_interval. ` must be between and
- agent ' ' `start_calendar_interval` must set at least one…
AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17).
Data as JSON: /api/errors/3c571c6dcfb6feb8.
Report an issue: GitHub.
Appendix: source
Thrown at src/system/edits.rs:944
},
EditOp::Line { line, .. } if lines.contains(&line.as_str()) => {
if !opts.force {
problems.push(format!(
" \"{}\" ({}): line edits have no ownership marker; use --force to remove the line",
req.path_raw,
req.describe_op()
));
} else if seen_lines.insert((req.path.clone(), line.clone())) {
// Two ids with the same line converge to one applied line
// and therefore produce one unapply action.
todo.push(UnapplyPlan { req, text });
}
}
EditOp::Line { .. } => {}
}
}
if !problems.is_empty() {
bail!(
"edits: cannot unapply these entries:\n{}",
problems.join("\n")
);
}
Ok(todo)
}
/// Ensure template functions or another concurrent actor did not invalidate
/// any edit ownership checks performed during planning.
pub(crate) fn validate_unapply(todo: &[UnapplyPlan<'_>]) -> Result<()> {
let mut checked = indexmap::IndexSet::new();
let mut problems = vec![];
for plan in todo {
if !checked.insert(plan.req.path.clone()) {
continue;
}
let result = if plan.req.path.is_symlink() {
Err(eyre::eyre!("{SYMLINK_REASON}"))View on GitHub (pinned to 533346cc37)