jdx/mise · error
an operation record always has an operation
Error message
an operation record always has an operation
What it means
PendingCheckpoint's operation accessor unwraps checkpoint.operation with expect because an operation record is constructed to always carry an Operation. Panics only if the checkpoint state machine allowed writing/reading a checkpoint without its operation field populated.
Solutions
- Delete the corrupt pending checkpoint state so history tracking restarts cleanly
- Upgrade/downgrade so the same mise version reads what it wrote
- Populate operation before persisting any checkpoint (fix the writer)
Defensive patterns
Strategy: validation
Validate before calling
// guard before reading pending checkpoints
if !checkpoint_has_operation(&pending_file) {
fs::remove_file(&pending_file).ok(); // discard corrupt state
} Prevention
- Avoid killing mise mid-write to history state files
- Don't mix mise versions against one state directory
- Validate checkpoint shape at load time and discard invalid files
When it happens
Trigger: Reading a pending checkpoint file (via kind/record/write_outcome paths) whose operation field is missing — e.g. a truncated or hand-edited pending state file, or a code path that serializes a checkpoint before setting operation.
Common situations: Corrupted or partially written pending operation state after a crash; manual tampering with mise's history state directory; version skew between writer and reader of the checkpoint format.
Understand the failure class
Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.
Related errors
- checked by the caller
- affected project exists in graph
- attestation requests must not have a streaming body
- bootstrap command is registered
- BootstrapPart values have clap names
AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17).
Data as JSON: /api/errors/b4dfbfa2738f3c34.
Report an issue: GitHub.
Appendix: source
Thrown at src/system/history/scope.rs:508
self.pending.checkpoint.tree.available = false;
self.pending.checkpoint.tree.reason = Some(format!("{err:#}"));
}
}
if let Err(err) = self.write_pending() {
warn!("history: could not persist the operation record: {err:#}");
}
}
fn kind(&self) -> OperationKind {
self.operation().kind
}
fn operation(&self) -> &Operation {
self.pending
.checkpoint
.operation
.as_ref()
.expect("an operation record always has an operation")
}
fn operation_mut(&mut self) -> &mut Operation {
self.pending
.checkpoint
.operation
.as_mut()
.expect("an operation record always has an operation")
}
fn record(&mut self, entry: JournalEntry) -> Result<u32> {
let seq = self.operation().journal.len() as u32;
self.operation_mut().journal.push(entry);
self.write_pending()
.map_err(|err| eyre::eyre!("could not persist the operation journal: {err:#}"))?;
if self.kind() == OperationKind::Bootstrap
&& let Some((_, before)) = &self.before
&& let JournalEntry::PathChanged { path, prior, .. } =View on GitHub (pinned to 533346cc37)