gitbutlerapp/gitbutler · error

Commit ' ' not found. Try running 'but status' to see…

Error message

Commit '{commit_id_str}' not found. Try running 'but status' to see available commits.

What it means

Resolution failure in parse_commit_id: the given identifier matched no commit in the IdMap (neither a CLI ID nor a partial SHA). The message directs the user to 'but status' to see the identifiers that are currently available.

Solutions

  1. Run `but status` and copy a valid commit ID from the output
  2. Re-check spelling/completeness of the ID
  3. Re-run after refreshing workspace state if the commit was recently created

Example fix

// before
but resolve abc123            # unknown id
// after
but status                    # find valid commit ids
but resolve <id-from-status>
Defensive patterns

Strategy: validation

Validate before calling

let ids = status_commit_ids(ctx); // from 'but status'
if !ids.iter().any(|id| id.starts_with(user_id)) {
    eprintln!("{user_id} not found; pick from but status");
}

Try / catch

if let Err(e) = parse_commit_id(ctx, input) {
    if e.to_string().contains("not found") {
        eprintln!("Run 'but status' to list valid commit ids");
    }
}

Prevention

When it happens

Trigger: `but resolve <commit-id>` / `but resolve --ai <commit-id>` with an ID that is not in the IdMap (unknown, truncated beyond recognition, or already gone).

Common situations: Typo in commit ID; commit was rebased away; referencing a branch or file when a commit is expected; stale terminal output from an older workspace state.

Understand the failure class

Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.

Related errors


AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18). Data as JSON: /api/errors/2771109f27e0ae54. Report an issue: GitHub.

Appendix: 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 58e5313667)