{"record":{"id":"07e8b8c09109c968","repo":"nikivdev/code","slug":"multiple-queued-commits-match-use-a-longer-has","errorCode":null,"errorMessage":"Multiple queued commits match {}. Use a longer hash.","messagePattern":"Multiple queued commits match (.+?)\\. Use a longer hash\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/commit.rs","lineNumber":7125,"sourceCode":"            }\n            Err(err) => debug!(path = %path.display(), error = %err, \"invalid commit queue entry\"),\n        }\n    }\n    entries.sort_by(|a, b| a.created_at.cmp(&b.created_at));\n    Ok(entries)\n}\n\nfn resolve_commit_queue_entry(repo_root: &Path, hash: &str) -> Result<CommitQueueEntry> {\n    let entries = load_commit_queue_entries(repo_root)?;\n    let matches: Vec<_> = entries\n        .into_iter()\n        .filter(|entry| commit_queue_entry_matches(entry, hash))\n        .collect();\n\n    match matches.len() {\n        0 => bail!(\"No queued commit matches {}\", hash),\n        1 => Ok(matches.into_iter().next().unwrap()),\n        _ => bail!(\"Multiple queued commits match {}. Use a longer hash.\", hash),\n    }\n}\n\nfn resolve_git_commit_sha(repo_root: &Path, hash: &str) -> Result<String> {\n    let rev = format!(\"{hash}^{{commit}}\");\n    let sha = git_capture_in(repo_root, &[\"rev-parse\", \"--verify\", &rev])\n        .with_context(|| format!(\"{hash} is not a valid git commit\"))?;\n    let trimmed = sha.trim();\n    if trimmed.is_empty() {\n        bail!(\"{hash} is not a valid git commit\");\n    }\n    Ok(trimmed.to_string())\n}\n\nfn queue_existing_commit_for_approval(\n    repo_root: &Path,\n    hash: &str,\n    mark_reviewed: bool,","sourceCodeStart":7107,"sourceCodeEnd":7143,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/commit.rs#L7107-L7143","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before (shell)\nf commit approve a1b\n// after (shell)\ngit rev-parse a1b        # get full sha\nf commit approve a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0","handlingStrategy":"validation","validationCode":"fn matching(queue: &[CommitQueueEntry], hash: &str) -> usize {\n    queue.iter().filter(|e| e.commit_sha.starts_with(hash)).count()\n}\nif matching(&entries, short_hash) > 1 {\n    eprintln!(\"ambiguous prefix {}; use a longer hash\", short_hash);\n}","typeGuard":null,"tryCatchPattern":"if let Err(e) = tool.resolve_queue_entry(hash) {\n    if e.contains(\"Multiple queued commits match\") {\n        let full = String::from_utf8(\n            Command::new(\"git\").args([\"rev-parse\", hash]).output()?.stdout)?;\n        tool.resolve_queue_entry(full.trim())?;\n    } else { return Err(e.into()); }\n}","preventionTips":["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"],"tags":["git","queue","ambiguity","user-input"],"backgroundTag":"ambiguous-short-hash","analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}