Hmbown/CodeWhale · warning · anyhow::Error

No diff to review.

Error message

No diff to review.

What it means

After collecting the diff (from a PR or local working tree), the review pipeline rejects an empty or whitespace-only diff, since there is nothing for the model to review. It bails before spending any model request.

Solutions

  1. Verify there are actual changes (`git status`, `git diff`) in the target directory/branch
  2. Remove or widen --path filters that exclude all changed files
  3. Check you're reviewing the intended PR — it may contain no file changes
  4. Stage or make the changes you intend to review

Example fix

// before (clean tree)
codewhale review
// after
git add -p  # make/stage changes first
codewhale review
Defensive patterns

Strategy: validation

Validate before calling

let diff = git_diff_output()?; if diff.trim().is_empty() { eprintln!("nothing to review: no working-tree or PR changes"); return 1; }

Prevention

When it happens

Trigger: Running `codewhale review` when collect_diff produced empty output — no uncommitted/staged changes, a PR with no file changes, or a path filter matching no files.

Common situations: Running review in a clean repo with no changes; reviewing the wrong branch or directory; a PR consisting only of merge commits/empty changes; overly restrictive --path filters.

Understand the failure class

Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22). Data as JSON: /api/errors/b23369056e660154. Report an issue: GitHub.

Appendix: source

Thrown at crates/tui/src/lib.rs:8612

        bail!(
            "`gh` CLI not found on PATH. Install GitHub CLI \
             (https://cli.github.com) and authenticate (`gh auth login`) \
             so `codewhale review --pr` can fetch the pull request."
        );
    }
    // Fetched before the diff so a missing/hidden PR fails before any model
    // route is resolved or billed.
    let pr_view = match args.pr {
        Some(number) => Some((number, run_gh_pr_view(number, args.repo.as_deref())?)),
        None => None,
    };
    let diff = collect_diff(
        &args,
        pr_view.as_ref().map(|(_, view)| view),
        &std::env::current_dir()?,
    )?;
    if diff.trim().is_empty() {
        bail!("No diff to review.");
    }
    if args.check_receipt {
        return run_review_receipt_check(&diff, &args, pr_view.as_ref().map(|(_, view)| view));
    }

    let pr_plan = pr_view
        .as_ref()
        .map(|(_, view)| {
            crate::tools::review::plan_pr_review(&diff, view, args.max_chars, args.max_passes)
        })
        .transpose()?;
    let review_workspace = std::env::current_dir()?;
    let (prompts, system) = if let (Some((number, view)), Some(plan)) = (&pr_view, &pr_plan) {
        (
            crate::tools::review::build_pr_review_prompts(*number, view, plan, &review_workspace)
                .await?,
            SystemPrompt::Text(crate::tools::review::review_system_prompt().to_string()),
        )

View on GitHub (pinned to 73e0f67d83)