Hmbown/CodeWhale · error

PR input exceeds the bounded capture limit (8 MiB diff); no…

Error message

PR input exceeds the bounded capture limit (8 MiB diff); no partial output was accepted

What it means

review_pr.rs runs PR-related git/gh commands via run_command, which captures stdout/stderr fully into memory. Before accepting the output it enforces hard caps (MAX_OUTPUT_BYTES ≈ 8 MiB for stdout, 64 KiB for stderr); if either is exceeded it bails with this message and discards the capture entirely — no truncated/partial output is ever used for review.

Solutions

  1. Split the review: fetch the diff in smaller chunks (e.g. per-file or per-path diffs) instead of one whole-PR diff
  2. Reduce diff size: use pinned git patches or binary blob IDs instead of an embedded baseline (the tool's own large-PR strategy), or exclude binary/generated files from the diff
  3. Check stderr noise: run the underlying git/gh command manually and silence or redirect the verbose stderr that exceeds 64 KiB
  4. If you own the tool: raise MAX_OUTPUT_BYTES or implement chunked/streaming capture

Example fix

// before
git(["diff", "HEAD..origin/pr"])?
// after
// limit the diff surface so the capture stays under 8 MiB
git(["diff", "HEAD..origin/pr", "--", "src/"])?
Defensive patterns

Strategy: validation

Validate before calling

if stdout.len() > 8 * 1024 * 1024 || stderr.len() > 64 * 1024 { /* chunk the diff before invoking */ }

Prevention

When it happens

Trigger: Calling fetch_diff, fetch_view, context_blob, or git() (and the tests large_pr_uses_all_pinned_git_patches_and_exact_binary_ids_not_the_checkout / oversized_embedded_binary_baseline_fails_but_metadata_fallback_is_complete) when the PR's diff or view output exceeds 8 MiB, or its stderr exceeds 64 KiB.

Common situations: Reviewing a very large PR with thousands of changed files or huge generated/binary assets embedded in the diff; a misbehaving git helper that spews massive stderr (e.g. verbose warnings, LFS noise) past 64 KiB.

Understand the failure class

Background: payload too large / request exceeds maximum size: why libraries cap bytes and how to fix oversize payloads — this error's family across 50 libraries.

Related errors


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

Appendix: source

Thrown at crates/tui/src/tools/review_pr.rs:504

        .context("PR command stderr unavailable")?;
    let stdout = std::thread::spawn(move || read_bounded(stdout, MAX_OUTPUT_BYTES));
    let stderr = std::thread::spawn(move || read_bounded(stderr, 64 * 1024));
    let status = match child.wait_timeout(Duration::from_secs(60))? {
        Some(status) => status,
        None => {
            let _ = child.kill();
            let _ = child.wait();
            bail!("PR input command timed out; no partial output was accepted");
        }
    };
    let stdout = stdout
        .join()
        .map_err(|_| anyhow::anyhow!("PR stdout reader failed"))??;
    let stderr = stderr
        .join()
        .map_err(|_| anyhow::anyhow!("PR stderr reader failed"))??;
    if stdout.len() > MAX_OUTPUT_BYTES || stderr.len() > 64 * 1024 {
        bail!(
            "PR input exceeds the bounded capture limit (8 MiB diff); no partial output was accepted"
        );
    }
    if !status.success() {
        bail!(
            "PR input command failed: {}",
            String::from_utf8_lossy(&stderr).trim()
        );
    }
    String::from_utf8(stdout).context("PR diff is not valid UTF-8; no lossy review is accepted")
}

#[cfg(test)]
mod tests {
    use super::*;

    fn view(files: usize) -> GhPullRequest {
        GhPullRequest {

View on GitHub (pinned to 73e0f67d83)