{"record":{"id":"e2e05bfff2c8b4d4","repo":"gitbutlerapp/gitbutler","slug":"commit-id-commit-id-str-is-ambiguous-please-p","errorCode":null,"errorMessage":"Commit ID '{commit_id_str}' is ambiguous. Please provide more characters to uniquely identify the commit.","messagePattern":"Commit ID '(.+?)' is ambiguous\\. Please provide more characters to uniquely identify the commit\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but/src/command/legacy/resolve.rs","lineNumber":170,"sourceCode":"}\n\n/// Resolve a user-provided commit identifier (CLI ID or partial SHA) to an\n/// object id, along with its display ref rendered from the same map.\nfn parse_commit_id(ctx: &mut Context, commit_id_str: &str) -> Result<(gix::ObjectId, String)> {\n    // Create an IdMap to resolve commit IDs (supports both CLI IDs and partial SHAs)\n    let id_map = IdMap::legacy_new_from_context(ctx)?;\n\n    // Resolve the commit ID using the IdMap\n    let matches = id_map.parse_using_context(commit_id_str, ctx)?;\n\n    if matches.is_empty() {\n        bail!(\n            \"Commit '{commit_id_str}' not found. Try running 'but status' to see available commits.\"\n        );\n    }\n\n    if matches.len() > 1 {\n        bail!(\n            \"Commit ID '{commit_id_str}' is ambiguous. Please provide more characters to uniquely identify the commit.\"\n        );\n    }\n\n    // Extract the commit OID from the matched CliId\n    match &matches[0] {\n        CliId::Commit {\n            commit: CommitId { commit_id, .. },\n            id: _,\n        } => {\n            let commit_ref = theme::Commit(CommitIdRef {\n                commit_id: *commit_id,\n                change_id: id_map\n                    .change_id_ref(*commit_id)\n                    .map(|change_id| &change_id.change_id),\n            })\n            .to_string();\n            Ok((*commit_id, commit_ref))","sourceCodeStart":152,"sourceCodeEnd":188,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/but/src/command/legacy/resolve.rs#L152-L188","documentation":"Resolution failure in parse_commit_id: the provided identifier is a prefix matching more than one commit, so it cannot be resolved uniquely. Provide more characters of the SHA/ID until the match is unambiguous.","triggerScenarios":"`but resolve <partial-id>` where the short ID prefix matches multiple commits/objects in the current workspace.","commonSituations":"Providing very short IDs (1-3 chars) in workspaces with many commits; ID prefixes shared between a commit and another entity type.","solutions":["Provide more characters of the commit ID until unique","Use the full 40-character OID copied from `but status` or `git log`"],"exampleFix":"// before\nbut resolve ab\n// after\nbut resolve ab3f9c2   # longer unambiguous prefix","handlingStrategy":"validation","validationCode":"let n = id_map_matches(input); // number of matches\nif n > 1 { eprintln!(\"{input} is ambiguous; lengthen the prefix\"); }","typeGuard":null,"tryCatchPattern":"if let Err(e) = parse_commit_id(ctx, input) {\n    if e.to_string().contains(\"ambiguous\") {\n        eprintln!(\"Provide more characters of the commit id\");\n    }\n}","preventionTips":["Use at least 7+ characters of the commit ID","Prefer full OIDs in automation","Check for prefix collisions when generating short IDs"],"tags":["cli","commit","ambiguity"],"backgroundTag":"invalid-identifier-format","analyzedSha":"58e5313667b857ef39a730e380af31816a7b1768","analyzedAt":"2026-09-18T06:50:32.052Z","contentChangedAt":"2026-09-18T06:50:32.052Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}