Hmbown/CodeWhale · warning · anyhow::Error
No diff to review.
Error message
No diff to review.
What it means
run_review() first collects the diff via collect_diff() — plain `git diff`, plus `--cached` with --staged, `base...HEAD` with --base, and an optional `--path` filter — and bails when the result trims to empty. There is nothing for the review model to look at, so the command aborts before model/route resolution.
Source
Thrown at crates/tui/src/lib.rs:7933
let input = input.trim();
if input.is_empty() {
bail!("No session selected.");
}
let idx: usize = input
.parse()
.map_err(|_| anyhow::anyhow!("Invalid input"))?;
let session = sessions
.get(idx.saturating_sub(1))
.ok_or_else(|| anyhow::anyhow!("Selection out of range"))?;
Ok(session.id.clone())
}
async fn run_review(config: &Config, args: ReviewArgs) -> Result<()> {
use crate::client::DeepSeekClient;
let diff = collect_diff(&args)?;
if diff.trim().is_empty() {
bail!("No diff to review.");
}
validate_review_receipt_args(&args)?;
if args.check_receipt {
return run_review_receipt_check(&diff, &args);
}
let model = resolve_review_model(config, args.model.as_deref());
let route = resolve_cli_exec_route(config, &model, &diff, args.model.is_none()).await?;
let execution_config = config_for_cli_route(config, &route);
let route_provider = execution_config.provider_identity_for(route.provider);
let model = route.model.clone();
let user_prompt =
format!("Review the following diff and provide feedback:\n\n{diff}\n\nEnd of diff.");
let reasoning_effort = route.reasoning_effort.and_then(|effort| {
cli_reasoning_effort_value_for_prompt(&execution_config, &model, effort, &user_prompt)
});
let system = SystemPrompt::Text(View on GitHub (pinned to 0c42157ee5)
Solutions
- Unstaged changes: ensure the tree differs from the index, or pass `--staged` when changes are staged
- Review a committed change with `--base` (e.g. `--base HEAD~1`)
- Check the `--path` filter matches files that actually changed (`git status`)
- Confirm you are inside the intended git repository
Example fix
// before: everything already committed, tree is clean $ git commit -am wip && codewhale review Error: No diff to review. // after: review the just-committed change against its parent $ codewhale review --base HEAD~1
Defensive patterns
Strategy: validation
Validate before calling
# mirror collect_diff's selection before invoking codewhale review if git diff --quiet && git diff --cached --quiet; then echo 'nothing to review: clean tree, nothing staged' >&2; exit 2 fi codewhale review
Prevention
- Decide the diff source (tree, --staged, --base) before running review
- Gate automation on `git diff --quiet` so an empty review is a skip, not a crash
When it happens
Trigger: Clean working tree with no --staged/--base (default diff empty); `--staged` with nothing staged; a `--base` equal to HEAD; or a `--path` filter matching no changes.
Common situations: Committing everything just before reviewing; forgetting --staged when all changes are staged; reviewing in the wrong repo/directory; a mistyped pathspec.
Related errors
- git diff failed: {}
- empty API key provided
- Model name cannot be empty
- worktree branch must not be empty
- repo root does not exist: {}
AI-assisted analysis of Hmbown/CodeWhale@0c42157ee5 (2026-08-20).
Data as JSON: /api/errors/b23369056e660154.
Report an issue: GitHub.