{"record":{"id":"c0e02479b92a3ace","repo":"jdx/mise","slug":"checkpoint-is-unavailable-cannot-find-the-stat","errorCode":null,"errorMessage":"checkpoint {} is unavailable; cannot find the state before operation {}","messagePattern":"checkpoint (.+?) is unavailable; cannot find the state before operation (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/history/replay.rs","lineNumber":299,"sourceCode":"    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\",\n            operation.id\n        );\n    };\n    let Some(before) = entries\n        .iter()\n        .find(|entry| &entry.checkpoint.uuid == before_uuid)\n        .cloned()\n    else {\n        bail!(\n            \"checkpoint {} is unavailable; cannot find the state before operation {}\",\n            before_uuid,\n            operation.id\n        );\n    };\n    if op.affected.is_empty() {\n        info!(\"history: operation {} touched nothing\", operation.id);\n        return Ok(());\n    }\n    let paths: Vec<PathBuf> = op\n        .affected\n        .iter()\n        .map(|path| normalize_target(Path::new(path)))\n        .collect();\n    let message = format!(\n        \"undid {} {} ({})\",\n        op.kind.as_str(),\n        operation.id,","sourceCodeStart":281,"sourceCodeEnd":317,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/history/replay.rs#L281-L317","documentation":"The operation references a protective 'before' checkpoint by UUID, but that checkpoint is not present in the loaded history entries. Without the snapshot's contents, undo cannot reconstruct pre-operation state and aborts.","triggerScenarios":"`entries.iter().find(|e| e.checkpoint.uuid == before_uuid)` returns `None` during undo — the referenced checkpoint was pruned, the history store was reset/reinitialized, or history was copied between machines losing entries.","commonSituations":"User manually cleaned or truncated the dotfiles history git store; history retention settings pruned old checkpoints; switching machines while referencing old operation ids.","solutions":["Restore the missing checkpoint in the history store (e.g. from a backup of the dotfiles git repo) and retry undo","Manually restore the affected files from your own backup, then let a fresh checkpoint re-baseline state","Prune the dangling operation from history so undo no longer resolves to it"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"const before = entries.find(e => e.checkpoint.uuid === op.before);\nif (!before) throw new Error('referenced before-checkpoint missing from history');","typeGuard":null,"tryCatchPattern":"try {\n  await mise.dot.undo();\n} catch (e) {\n  if (/is unavailable/.test(e.message)) {\n    // restore from external backup or prune the dangling entry\n  }\n}","preventionTips":["Do not delete or truncate the dotfiles history store","Back up history before retention pruning or migration","Keep history on one machine or migrate it fully"],"tags":["dotfiles","undo","history"],"backgroundTag":"record-not-found","analyzedSha":"533346cc374382b41ec5ff70536252b2e96e725c","analyzedAt":"2026-09-17T13:35:38.149Z","contentChangedAt":"2026-09-17T13:35:38.149Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}