Hmbown/CodeWhale · error
A full Git history is required to establish the PR merge…
Error message
A full Git history is required to establish the PR merge base
What it means
diff_with first tries GitHub's diff; on fallback it computes the merge base locally with `git merge-base --all`. Before that it checks `git rev-parse --is-shallow-repository`; a shallow clone cannot reliably establish the PR merge base, so the tool refuses instead of producing a diff against a fabricated base.
Solutions
- Unshallow the repo: `git fetch --unshallow origin` (or `git fetch --deepen=...`), then rerun the review
- In CI, raise the checkout depth (e.g. actions/checkout with fetch-depth: 0)
- Verify with `git rev-parse --is-shallow-repository` that it now prints `false` before retrying
Example fix
// before: CI shallow checkout
- uses: actions/checkout@v4
with:
fetch-depth: 1
// after: full history so merge-base works
- uses: actions/checkout@v4
with:
fetch-depth: 0 Defensive patterns
Strategy: fallback
Validate before calling
// fail before calling the tool if the clone is shallow
let shallow = git rev-parse --is-shallow-repository;
if shallow.trim() != "false" {
bail!("unshallow first: git fetch --unshallow origin");
} Try / catch
let out = Command::new("git").args(["rev-parse","--is-shallow-repository"]).output()?;
if String::from_utf8_lossy(&out.stdout).trim() != "false" {
Command::new("git").args(["fetch","--unshallow","origin"]).status()?;
}
// then retry the review Prevention
- Use fetch-depth: 0 in CI checkouts
- Avoid `git clone --depth`/--shallow-since for review workspaces
- Check `git rev-parse --is-shallow-repository` in environment setup and unshallow proactively
When it happens
Trigger: fetch_diff's fallback path runs in a repo where `git rev-parse --is-shallow-repository` prints anything other than `false` (typically `true` from a CI checkout with fetch-depth: 1).
Common situations: GitHub Actions / other CI with shallow checkouts; `git clone --depth` or `--shallow-since` local clones; gitpod/devcontainer shallow init scripts.
Understand the failure class
Background: "git command failed": what it means when a tool shells out to git and git exits non-zero — this error's family across 21 libraries.
Related errors
- The pinned PR commits do not have one available merge base
- account_agent_model_unconfigured
- Annotated tag did not peel to a commit SHA
- baseline provenance must identify a clean source tree
- baseline provenance needs an exact source SHA
AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22).
Data as JSON: /api/errors/737e433c2d50d305.
Report an issue: GitHub.
Appendix: source
Thrown at crates/tui/src/tools/review_pr.rs:274
// completeness: also check the metadata's changed-file count.
let remote = if view.changed_files <= 300 {
run(Program::Gh, &pr_args("diff", number, repo)).and_then(|diff| {
complete_file_set(&diff, view)?;
Ok(diff)
})
} else {
Err(anyhow::anyhow!("GitHub diff exceeds its 300-file limit"))
};
let diff = match remote {
Ok(diff) => diff,
Err(remote_error) => {
let local: Result<String> = (|| {
let shallow = run(
Program::Git,
&["rev-parse".into(), "--is-shallow-repository".into()],
)?;
if shallow.trim() != "false" {
bail!("A full Git history is required to establish the PR merge base");
}
let base = run(
Program::Git,
&[
"merge-base".into(),
"--all".into(),
view.base_sha.clone(),
view.head_sha.clone(),
],
)?;
let base = base.trim();
if !commit_id(base) {
bail!("The pinned PR commits do not have one available merge base");
}
let diff = run(
Program::Git,
&[
"diff".into(),View on GitHub (pinned to 73e0f67d83)