{"record":{"id":"01589bdeafd8ecf5","repo":"jdx/mise","slug":"checkpoint-is-not-an-operation","errorCode":null,"errorMessage":"checkpoint {} is not an operation","messagePattern":"checkpoint (.+?) is not an operation","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/history/replay.rs","lineNumber":272,"sourceCode":"        undoes_of.insert(entry.checkpoint.uuid.clone(), target);\n    }\n    let operation = match &req.reference {\n        Some(reference) => crate::cli::dotfiles::history::resolve(reference, &entries, None)?,\n        None => entries\n            .iter()\n            .rev()\n            .find(|entry| {\n                entry.checkpoint.operation.as_ref().is_some_and(|op| {\n                    op.status != OperationStatus::Pending\n                        && op.before.is_some()\n                        && !op.affected.is_empty()\n                }) && !undone.contains(&entry.checkpoint.uuid)\n            })\n            .cloned()\n            .ok_or_else(|| eyre::eyre!(\"nothing to undo: no tracked-file operation is left\"))?,\n    };\n    let Some(op) = operation.checkpoint.operation.clone() else {\n        bail!(\"checkpoint {} is not an operation\", operation.id);\n    };\n    // Undo restores tracked files only, never package or service state.\n    if op.status == OperationStatus::Pending {\n        bail!(\n            \"checkpoint {} is still running or was interrupted; nothing to undo\",\n            operation.id\n        );\n    }\n    if op.status == OperationStatus::Failed && !op.affected.is_empty() {\n        info!(\n            \"history: operation {} failed midway; reversing the {} path(s) it changed\",\n            operation.id,\n            op.affected.len()\n        );\n    }\n    let Some(before_uuid) = &op.before else {\n        bail!(\n            \"checkpoint {} has no protective checkpoint to undo from\",","sourceCodeStart":254,"sourceCodeEnd":290,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/system/history/replay.rs#L254-L290","documentation":"Undo operates on checkpoints that record a dotfiles operation (with affected paths, status, and a protective before-checkpoint). The selected checkpoint exists but its checkpoint.operation field is None, meaning it is not an operation checkpoint, so there is nothing to undo. mise bails identifying the checkpoint by id.","triggerScenarios":"Running `undo` when the most recent eligible checkpoint is a non-operation checkpoint (e.g. a manual snapshot/savepoint rather than a recorded operation). Condition: operation.checkpoint.operation.clone() is None.","commonSituations":"Users create manual checkpoints then try to undo them; history contains mixed checkpoint types after manual saves; undo picks an older checkpoint because newer ones were already undone.","solutions":["Run undo again or pick a checkpoint that corresponds to an actual operation","Use rollback with explicit paths instead of undo for non-operation checkpoints","Inspect `mise bootstrap dotfiles history` to see which checkpoints are operations"],"exampleFix":"// before\nmise bootstrap dotfiles undo   # targets a manual snapshot\n// after\nmise bootstrap dotfiles rollback --to <ref> --all   # restore via rollback instead","handlingStrategy":"validation","validationCode":"const entry = await getCheckpoint(id);\nif (!entry?.checkpoint?.operation) {\n  throw new Error(`checkpoint ${id} is not an operation`);\n}","typeGuard":"const isOperation = (c: CheckpointEntry): c is CheckpointEntry & { checkpoint: { operation: Operation } } =>\n  c.checkpoint.operation != null;","tryCatchPattern":"try {\n  await undo();\n} catch (e) {\n  if (String(e).includes(\"is not an operation\")) {\n    console.error(\"Use rollback for non-operation checkpoints.\");\n  } else throw e;\n}","preventionTips":["Check the history listing for operation checkpoints before undo","Only construct undo requests from entries with a populated operation field","Distinguish manual snapshots from operations in UI/tooling"],"tags":["undo","checkpoint","state"],"backgroundTag":"unsupported-operation","analyzedSha":"afd2eddd3a50c16190efc1c7e94404b48f72af57","analyzedAt":"2026-09-09T01:38:25.179Z","contentChangedAt":"2026-09-09T01:38:25.179Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}