nikivdev/code · error
Multiple queued commits match {}. Use a longer hash.
Error message
Multiple queued commits match {}. Use a longer hash. What it means
When multiple commit-queue entries match the given (partial) hash, the resolver refuses to guess and throws this error, telling the user to supply a longer hash. It is an ambiguity guard on the short-hash lookup.
Source
Thrown at src/commit.rs:7125
}
Err(err) => debug!(path = %path.display(), error = %err, "invalid commit queue entry"),
}
}
entries.sort_by(|a, b| a.created_at.cmp(&b.created_at));
Ok(entries)
}
fn resolve_commit_queue_entry(repo_root: &Path, hash: &str) -> Result<CommitQueueEntry> {
let entries = load_commit_queue_entries(repo_root)?;
let matches: Vec<_> = entries
.into_iter()
.filter(|entry| commit_queue_entry_matches(entry, hash))
.collect();
match matches.len() {
0 => bail!("No queued commit matches {}", hash),
1 => Ok(matches.into_iter().next().unwrap()),
_ => bail!("Multiple queued commits match {}. Use a longer hash.", hash),
}
}
fn resolve_git_commit_sha(repo_root: &Path, hash: &str) -> Result<String> {
let rev = format!("{hash}^{{commit}}");
let sha = git_capture_in(repo_root, &["rev-parse", "--verify", &rev])
.with_context(|| format!("{hash} is not a valid git commit"))?;
let trimmed = sha.trim();
if trimmed.is_empty() {
bail!("{hash} is not a valid git commit");
}
Ok(trimmed.to_string())
}
fn queue_existing_commit_for_approval(
repo_root: &Path,
hash: &str,
mark_reviewed: bool,View on GitHub (pinned to a747e741ae)
Solutions
- Re-run with a longer hash prefix (7+ characters is the usual convention)
- Use the full 40-character SHA from `git rev-parse <short>`
- List the queue and pick the exact entry you want
Example fix
// before (shell) f commit approve a1b // after (shell) git rev-parse a1b # get full sha f commit approve a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0
Defensive patterns
Strategy: validation
Validate before calling
fn matching(queue: &[CommitQueueEntry], hash: &str) -> usize {
queue.iter().filter(|e| e.commit_sha.starts_with(hash)).count()
}
if matching(&entries, short_hash) > 1 {
eprintln!("ambiguous prefix {}; use a longer hash", short_hash);
} Try / catch
if let Err(e) = tool.resolve_queue_entry(hash) {
if e.contains("Multiple queued commits match") {
let full = String::from_utf8(
Command::new("git").args(["rev-parse", hash]).output()?.stdout)?;
tool.resolve_queue_entry(full.trim())?;
} else { return Err(e.into()); }
} Prevention
- Default to 7+ character hash prefixes in scripts
- Expand short hashes with `git rev-parse` before passing them
- Avoid 1–4 character abbreviations when the queue has many entries
When it happens
Trigger: Passing a very short hash prefix (e.g. 2-4 characters) that is a prefix of more than one queued commit's SHA, so commit_queue_entry_matches() returns several entries.
Common situations: Using a 1–4 character abbreviation while the queue holds several nearby commits, or queued commits from rebase/cherry-pick operations sharing leading hex digits.
Related errors
- multiple session-doc queue entries match `{session_hint}`
- No queued commit matches {}
- no session-doc queue entry matches `{session_hint}`
- Commit queue is empty.
- No PR found for current branch and commit queue is empty.
AI-assisted analysis of nikivdev/code@a747e741ae (2026-09-01).
Data as JSON: /api/errors/07e8b8c09109c968.
Report an issue: GitHub.