jdx/mise · critical
dotfiles: rollback failed
Error message
{err}
dotfiles: rollback failed: {rollback_err} What it means
When `mise dot add` fails during apply, it attempts a rollback; if the rollback itself also fails, mise raises a combined error showing the original failure plus `dotfiles: rollback failed: ...`. The system may be left in a partially applied state that the user must repair manually.
Solutions
- Read both parts of the message; fix the rollback failure cause first (permissions, missing backup paths)
- Manually restore targets from the backup locations listed/known to mise (e.g. `.bak` copies created during apply)
- Re-create symlinks or copy back originals for the affected dotfiles
- Once state is clean, re-run `mise dot add`
Defensive patterns
Strategy: try-catch
Validate before calling
# preflight checks that make both apply and rollback safe test -w "$(dirname "$CFG")" && df -h "$(dirname "$CFG")" | tail -1
Try / catch
match result {
Err(e) if e.to_string().contains("rollback failed") => {
// manual recovery: restore backups, then re-add
}
...
} Prevention
- Back up the mise config and dotfiles before large `mise dot add` batches
- Don't interrupt `mise dot add` mid-apply
- Ensure directories are writable so rollback can complete
When it happens
Trigger: An apply-phase error (err) occurs, `rollback_add` runs and returns rollback_err; the code bails with the concatenated message.
Common situations: Disk/permission problems that caused the original failure also break rollback (e.g. cannot remove or restore backup files); config file was moved mid-run; crash left stale state.
Understand the failure class
Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.
Related errors
- {}
- a glob is required
- `--all` needs `--to
- an implied source entry key must be relative
- an implied source entry key must not be empty
AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17).
Data as JSON: /api/errors/ab44606ed494e96c.
Report an issue: GitHub.
Appendix: source
Thrown at src/cli/dotfiles/add.rs:494
if !updated_targets.is_empty() {
info!("dotfiles: updated {}", updated_targets.join(", "));
}
if let Some(plan) = apply_plan {
apply_started = true;
system::files::execute_apply(&config, plan, &apply_opts)?;
}
Ok(())
})();
if let Err(err) = result {
if let Err(rollback_err) = rollback_add(
&source_backups,
&target_backups,
&mut moved_targets,
apply_started,
&config_path,
original_config.as_deref(),
) {
bail!("{err}\ndotfiles: rollback failed: {rollback_err}");
}
return Err(err);
}
Ok(())
}
}
#[derive(Debug)]
struct PlannedAdd {
target_raw: String,
target: PathBuf,
source: PathBuf,
mode: FileMode,
implied_source: bool,
explicit_mode: bool,
already_managed: Option<FileRequest>,
}
View on GitHub (pinned to 533346cc37)