{"record":{"id":"3ce8702dbf41316d","repo":"jdx/mise","slug":"spec-matches-more-than-one-checkpoint-use-a-l","errorCode":null,"errorMessage":"{spec:?} matches more than one checkpoint; use a longer prefix","messagePattern":"(.+?) matches more than one checkpoint; use a longer prefix","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/history/store.rs","lineNumber":927,"sourceCode":"        return entries\n            .iter()\n            .find(|entry| entry.id == id)\n            .map(|entry| entry.id)\n            .ok_or_else(|| eyre!(\"no history checkpoint matches {spec:?}\"));\n    } else {\n        spec\n    };\n    if prefix.is_empty() {\n        bail!(\"invalid checkpoint reference {spec:?}\");\n    }\n    let matches: Vec<&Entry> = entries\n        .iter()\n        .filter(|entry| entry.checkpoint.uuid.starts_with(prefix))\n        .collect();\n    match matches.as_slice() {\n        [one] => Ok(one.id),\n        [] => bail!(\"no history checkpoint matches {spec:?}\"),\n        _ => bail!(\"{spec:?} matches more than one checkpoint; use a longer prefix\"),\n    }\n}\n\npub(crate) fn now_rfc3339() -> String {\n    chrono::Utc::now().to_rfc3339_opts(chrono::SecondsFormat::Millis, true)\n}\n\npub(crate) fn new_uuid() -> String {\n    uuid::Uuid::now_v7().to_string()\n}\n\npub(crate) fn write_json<T: Serialize>(path: &Path, value: &T) -> Result<()> {\n    let mut text = serde_json::to_string_pretty(value)?;\n    text.push('\\n');\n    if let Some(parent) = path.parent() {\n        file::create_dir_all(parent)?;\n    }\n    file::write_atomic(path, text).wrap_err_with(|| format!(\"writing {}\", display_path(path)))?;","sourceCodeStart":909,"sourceCodeEnd":945,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/system/history/store.rs#L909-L945","documentation":"When resolving a checkpoint reference by UUID prefix, more than one stored entry may share that prefix. Because the tool cannot know which one is intended, it refuses and asks for a longer prefix that narrows to exactly one match. This is standard short-hash ambiguity handling, mirroring git's behavior.","triggerScenarios":"Calling the checkpoint-resolution API with a short prefix (often 1-2 characters) that matches two or more checkpoint UUIDs in the store.","commonSituations":"Using a very short prefix in a store with many checkpoints; scripting with a fixed-length prefix assumption that breaks as history grows.","solutions":["Repeat the command with more characters of the UUID until it's unique.","Use the full UUID from `mise dot log` to be unambiguous.","In scripts, resolve the full ID once and reuse it instead of a short prefix.","If two checkpoints really are duplicates of the same state, prune one from history."],"exampleFix":"// before\nlet id = resolve_checkpoint(\"a\")?; // ambiguous\n// after\nlet full = list_checkpoints()?.iter().find(|c| c.checkpoint.uuid.starts_with(\"a\")).unwrap().checkpoint.uuid.clone();\nlet id = resolve_checkpoint(&full)?;","handlingStrategy":"validation","validationCode":"let hits: Vec<_> = list_checkpoints()?.into_iter().filter(|c| c.checkpoint.uuid.starts_with(prefix)).collect();\nif hits.len() > 1 {\n    eprintln!(\"prefix {prefix:?} is ambiguous; use a longer prefix or the full uuid\");\n}","typeGuard":null,"tryCatchPattern":"match resolve_checkpoint(prefix) {\n    Ok(id) => use(id),\n    Err(e) if e.to_string().contains(\"matches more than one checkpoint\") => {\n        eprintln!(\"extend the prefix; candidates listed in `mise dot log`\");\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Prefer full UUIDs over short prefixes in scripts","Use at least 6-8 characters of prefix as history grows","Resolve the full id once and store it, rather than re-resolving prefixes"],"tags":["cli","checkpoint","ambiguous-prefix","dotfiles"],"backgroundTag":"ambiguous-identifier-prefix","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"}