gitbutlerapp/gitbutler · error
Commit ID '{commit_id_str}' is ambiguous. Please provide mor
Error message
Commit ID '{commit_id_str}' is ambiguous. Please provide more characters to uniquely identify the commit. What it means
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).
Source
Thrown at crates/but/src/command/legacy/resolve.rs:170
}
/// Resolve a user-provided commit identifier (CLI ID or partial SHA) to an
/// object id, along with its display ref rendered from the same map.
fn parse_commit_id(ctx: &mut Context, commit_id_str: &str) -> Result<(gix::ObjectId, String)> {
// Create an IdMap to resolve commit IDs (supports both CLI IDs and partial SHAs)
let id_map = IdMap::legacy_new_from_context(ctx)?;
// Resolve the commit ID using the IdMap
let matches = id_map.parse_using_context(commit_id_str, ctx)?;
if matches.is_empty() {
bail!(
"Commit '{commit_id_str}' not found. Try running 'but status' to see available commits."
);
}
if matches.len() > 1 {
bail!(
"Commit ID '{commit_id_str}' is ambiguous. Please provide more characters to uniquely identify the commit."
);
}
// Extract the commit OID from the matched CliId
match &matches[0] {
CliId::Commit {
commit: CommitId { commit_id, .. },
id: _,
} => {
let commit_ref = theme::Commit(CommitIdRef {
commit_id: *commit_id,
change_id: id_map
.change_id_ref(*commit_id)
.map(|change_id| &change_id.change_id),
})
.to_string();
Ok((*commit_id, commit_ref))View on GitHub (pinned to caf1f223d3)
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.
Example fix
# before but resolve 4 # matches several commits -> ambiguous # after but resolve 4a2 # unique prefix (or the full SHA)
Defensive patterns
Strategy: validation
Validate before calling
# Ensure the prefix resolves to exactly one entity before resolving but status | grep -cF '<id>' # a count above 1 means: lengthen the prefix
Prevention
- Lengthen prefixes until unique; use full SHAs in scripts.
- Re-resolve IDs once and store the full form instead of reusing brittle prefixes.
When it happens
Trigger: `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.
Common situations: Growing stacks making previously-unique prefixes collide; scripts reusing hardcoded short prefixes across sessions.
Related errors
- Ambiguous branch '{branch_id}', matches multiple items
- Commit '{commit_id_str}' not found. Try running 'but status'
- '{commit_id_str}' does not refer to a commit
- No branch found for ID: {branch_id}
- Could not find branch: {branch_id}
AI-assisted analysis of gitbutlerapp/gitbutler@caf1f223d3 (2026-08-20).
Data as JSON: /api/errors/e2e05bfff2c8b4d4.
Report an issue: GitHub.