{"record":{"id":"f105cd1262c382ac","repo":"Hmbown/CodeWhale","slug":"complete-local-diff-requires-chars-characters-exceeding-the","errorCode":null,"errorMessage":"Complete local diff requires {chars} characters, exceeding the review limit of {max_chars}. No review was run and no receipt was written or accepted. Select an explicit --path scope, or increase --max-chars only if the selected model can accept the complete input.","messagePattern":"Complete local diff requires (.+?) characters, exceeding the review limit of (.+?)\\. No review was run and no receipt was written or accepted\\. Select an explicit --path scope, or increase --max-chars only if the selected model can accept the complete input\\.","errorType":"error_code","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/tui/src/lib.rs","lineNumber":9871,"sourceCode":"        let output = cmd\n            .output()\n            .map_err(|e| anyhow::anyhow!(\"Failed to run git diff. Is git installed? ({e})\"))?;\n        if !output.status.success() {\n            let stderr = String::from_utf8_lossy(&output.stderr);\n            bail!(\"git diff failed: {}\", stderr.trim());\n        }\n        String::from_utf8_lossy(&output.stdout).to_string()\n    };\n    if args.pr.is_none() {\n        ensure_local_review_diff_fits(&diff, args.max_chars)?;\n    }\n    Ok(diff)\n}\n\nfn ensure_local_review_diff_fits(diff: &str, max_chars: usize) -> Result<()> {\n    let chars = diff.chars().count();\n    if chars > max_chars {\n        bail!(\n            \"Complete local diff requires {chars} characters, exceeding the review limit of {max_chars}. No review was run and no receipt was written or accepted. Select an explicit --path scope, or increase --max-chars only if the selected model can accept the complete input.\"\n        );\n    }\n    Ok(())\n}\n\nfn review_target_label(args: &ReviewArgs) -> String {\n    let mut label = if let Some(number) = args.pr {\n        format!(\"pr:{number}\")\n    } else if args.staged {\n        \"staged\".to_string()\n    } else if let Some(base) = args\n        .base\n        .as_deref()\n        .map(str::trim)\n        .filter(|base| !base.is_empty())\n    {\n        format!(\"base:{base}\")","sourceCodeStart":9853,"sourceCodeEnd":9889,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/lib.rs#L9853-L9889","documentation":"Before sending a complete local diff for review, the code counts its characters and refuses to proceed if it exceeds the configured --max-chars limit. This is a deliberate guard: no model request is made and no review receipt is written or accepted when the diff is truncated implicitly.","triggerScenarios":"`ensure_local_review_diff_fits` finds `diff.chars().count() > max_chars` — the full working-tree diff (no --path scope) is larger than the review character budget.","commonSituations":"Reviewing a big refactor or vendored-code drop with the default limit; diffing binary-ish or generated files that inflate the diff; running against a monorepo without narrowing scope.","solutions":["Narrow the review with an explicit `--path <scope>` so only relevant files are diffed","Increase `--max-chars` only if the selected model's context window can accept the complete input","Reduce the diff itself: split the change, or exclude generated/vendored files from the review scope"],"exampleFix":"// before\ncodewhale review            # 900k-char diff vs 200k limit\n// after\ncodewhale review --path crates/tui --max-chars 200000","handlingStrategy":"validation","validationCode":"let chars: usize = git_diff.chars().count();\nif chars > max_chars { /* narrow with --path or raise max_chars before invoking review */ }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always scope reviews with --path on large working trees","Check diff size (`git diff | wc -m`) before running the review","Raise --max-chars only after confirming the model's context window"],"tags":["cli","review","limit","diff"],"backgroundTag":"payload-too-large","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-22T16:17:23.217Z"}