{"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":"exception","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/caf1f223d3cfb94488c9198ad34487c6006c648f/crates/but/src/command/legacy/resolve.rs#L152-L188","documentation":"The commit ID prefix matched more than one entity in the IdMap, so `but resolve` refuses to guess and asks for more characters (resolve.rs:169-173). This mirrors the ambiguity handling of the other ID-based commands (land, absorb).","triggerScenarios":"`but resolve <prefix>` where the prefix is a prefix of two or more IDs — short prefixes in workspaces with many commits, branches, and uncommitted files.","commonSituations":"Growing stacks making previously-unique prefixes collide; scripts reusing hardcoded short prefixes across sessions.","solutions":["Add characters until the ID is unique (verify in `but status`).","Use the full SHA for absolute precision in scripts.","For repeated automation, resolve the full ID once and pass that."],"exampleFix":"# before\nbut resolve 4     # matches several commits -> ambiguous\n\n# after\nbut resolve 4a2   # unique prefix (or the full SHA)","handlingStrategy":"validation","validationCode":"# Ensure the prefix resolves to exactly one entity before resolving\nbut status | grep -cF '<id>'   # a count above 1 means: lengthen the prefix","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Lengthen prefixes until unique; use full SHAs in scripts.","Re-resolve IDs once and store the full form instead of reusing brittle prefixes."],"tags":["cli","resolve","id-resolution","ambiguous","gitbutler"],"backgroundTag":"ambiguous-identifier","analyzedSha":"caf1f223d3cfb94488c9198ad34487c6006c648f","analyzedAt":"2026-08-20T07:55:40.983Z","schemaVersion":2},"datasetVersion":"2026-08-23T16:17:53.355Z"}