gitbutlerapp/gitbutler · error
Commit '{commit_id_str}' not found. Try running 'but status'
Error message
Commit '{commit_id_str}' not found. Try running 'but status' to see available commits. What it means
`but resolve <commit-id>` resolves the ID through the legacy IdMap, which supports both CLI IDs and partial SHAs (resolve.rs:162-167). Zero matches means the ID is unknown in this workspace — typo, stale short ID, or wrong project — and the message points you at `but status` to list available commits.
Source
Thrown at crates/but/src/command/legacy/resolve.rs:164
t.success.paint("✓ Marked as resolved:"),
t.attention.paint(path)
)?;
}
}
Ok(())
}
/// 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,View on GitHub (pinned to caf1f223d3)
Solutions
- Run `but status` and copy a current commit ID.
- Lengthen the partial SHA or use the CLI ID printed by status.
- Confirm you are in the same workspace/project the ID came from.
Example fix
# before but resolve 4z1 # no matches -> Commit '4z1' not found # after but status # copy a valid commit ID but resolve 5c
Defensive patterns
Strategy: validation
Validate before calling
but status | grep -F '<id>' || { echo 'unknown commit id'; exit 2; }
but resolve '<id>' Prevention
- Refresh IDs from `but status` after any history-rewriting operation.
- Prefer CLI IDs over raw partial SHAs — they are validated against the current workspace.
When it happens
Trigger: `but resolve <id>` where `parse_using_context` returns an empty vec: partial SHA too short or wrong, ID copied from another workspace/clone, or the commit removed by a rebase/squash since the ID was copied.
Common situations: Partial SHAs that were unique in a different clone; IDs invalidated when history was rewritten; simple typos in short IDs.
Related errors
- Commit ID '{commit_id_str}' is ambiguous. Please provide mor
- '{commit_id_str}' does not refer to a commit
- No branch found for ID: {branch_id}
- Could not find branch: {branch_id}
- Ambiguous branch '{branch_id}', matches multiple items
AI-assisted analysis of gitbutlerapp/gitbutler@caf1f223d3 (2026-08-20).
Data as JSON: /api/errors/2771109f27e0ae54.
Report an issue: GitHub.