jdx/mise · error

the annotated commit is not in the current history

Error message

the annotated commit is not in the current history

What it means

Before rewriting dotfile history with an annotation commit, mise verifies the target commit is reachable from the current history HEAD via rev-list. If the commit is not an ancestor of the current history, the annotation would be attached to a dangling commit, so mise refuses. This protects the integrity of the shadow dotfile history graph.

Solutions

  1. Run `mise dotfiles history list` (or equivalent) to see currently valid checkpoints.
  2. Annotate an existing reachable checkpoint instead of the stale commit id.
  3. If history was unintentionally rewritten, restore the previous history repo state from backup.
  4. If the commit is genuinely gone, recreate the annotation on a fresh checkpoint.

Example fix

// before: stale commit id
$ mise dotfiles annotate a1b2c3d "note"
Error: the annotated commit is not in the current history

// after: use a current checkpoint
$ mise dotfiles history list
$ mise dotfiles annotate <current-checkpoint-id> "note"
Defensive patterns

Strategy: validation

Validate before calling

let reachable = history.rev_list(head, usize::MAX)?.iter().any(|c| c == target);
if !reachable {
  eprintln!("{target} is not in current history; pick a checkpoint from `history list`");
}

Type guard

fn is_annotatable(history: &HistoryRepo, target: &str) -> bool {
  history.rev_list(head(), usize::MAX)
    .map(|commits| commits.iter().any(|c| c == target))
    .unwrap_or(false)
}

Prevention

When it happens

Trigger: Annotating a dotfile history checkpoint whose commit hash is no longer reachable: after history was rewritten/reset, the checkpoint was pruned, or the user supplied a stale commit id from an older history repo.

Common situations: History repo re-initialized or reset between creating and annotating a checkpoint; annotating from a different machine's history; referencing an old commit id after a force-rewrite of the shadow history.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17). Data as JSON: /api/errors/c381e3db38c4b155. Report an issue: GitHub.

Appendix: source

Thrown at src/system/history/shadow.rs:1653

    const ANNOTATION_TRAILER: &'static str = "Mise-Annotation: ";

    /// An annotation is an empty ordinary child commit, so labels and
    /// descriptions travel with the same ancestry without rewriting it.
    pub(crate) fn write_annotation(
        &self,
        target: &str,
        annotation: &super::store::Annotation,
    ) -> Result<()> {
        let head = self
            .ref_oid(Self::HISTORY_REF)?
            .ok_or_else(|| eyre::eyre!("no history to annotate"))?;
        if !self
            .rev_list(&head, usize::MAX)?
            .iter()
            .any(|commit| commit == target)
        {
            bail!("the annotated commit is not in the current history");
        }
        let message = format!(
            "annotate dotfile history\n\n{}{}",
            Self::ANNOTATION_TRAILER,
            serde_json::to_string(&(target, annotation))?
        );
        let commit = self.commit_tree(&self.output_tree_of(&head)?, vec![&head], &message)?;
        self.update_history_head(&commit, Some(&head))
    }

    #[cfg(test)]
    pub(crate) fn read_annotation(
        &self,
        commit: &str,
    ) -> Result<Option<(String, super::store::Annotation)>> {
        let message = self.output_str(PlumbingCall::new(["show", "-s", "--format=%B", commit]))?;
        Self::annotation_from_message(&message)
    }

View on GitHub (pinned to 533346cc37)