Hmbown/CodeWhale · error
Pinned source is not bounded text
Error message
Pinned source is not bounded text
What it means
After reading the pinned blob with `git cat-file blob`, `context_blob` enforces two bounds: the content must be at most `MAX_CONTEXT_FILE_BYTES` and must contain no NUL byte. This guarantees the source context handed to review passes is bounded plain text, not a huge or binary payload.
Solutions
- Exclude large/binary files from review context (respect .gitattributes or a size filter) before calling `source_context`
- Add the offending file to .gitignore or remove it from the repository
- Increase `MAX_CONTEXT_FILE_BYTES` only if the pipeline can genuinely afford larger contexts
Example fix
// before
for path in changed_files { ctx.push(source_context(ws, commit, path)?); }
// after
for path in changed_files {
if is_probably_binary(ws, commit, &path) { continue; }
if blob_size(ws, commit, &path)? > MAX_CONTEXT_FILE_BYTES { continue; }
ctx.push(source_context(ws, commit, &path)?);
} Defensive patterns
Strategy: validation
Validate before calling
let size = git(["cat-file", "-s", blob_id])?; if size > MAX_CONTEXT_FILE_BYTES { skip(path); } let head = read_first_bytes(ws, blob_id, 8192)?; if head.contains(&0) { skip_binary(path); } Try / catch
match source_context(ws, commit, path) { Ok(src) => Some(src), Err(e) if e.to_string().contains("bounded text") => { warn!("skipping oversized/binary {path}"); None }, Err(e) => return Err(e) } Prevention
- Pre-filter review context by blob size and a NUL-byte sniff
- Keep build artifacts and binaries out of the repo (.gitignore, CI checks)
- Only raise MAX_CONTEXT_FILE_BYTES deliberately, with budget analysis
When it happens
Trigger: The pinned blob exceeds `MAX_CONTEXT_FILE_BYTES`, or the blob is binary (contains a NUL byte) — e.g. a minified bundle, image, or compiled artifact was committed and included in the review context.
Common situations: Reviewing PRs that commit build artifacts, vendor trees, or generated minified JS; large data fixtures; accidentally committed binaries that pass the regular-file check.
Understand the failure class
Background: "File too large" / "file size exceeds limit" errors: why libraries cap file sizes and how to fix them — this error's family across 46 libraries.
Related errors
- Pinned source is missing, non-regular or exceeds the…
- A full Git history is required to establish the PR merge…
- 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/9868e696676d3145.
Report an issue: GitHub.
Appendix: source
Thrown at crates/tui/src/tools/review_pr.rs:448
.context("No pinned source blob")?;
let fields = header.split_whitespace().collect::<Vec<_>>();
anyhow::ensure!(
returned_path == path
&& fields.len() == 4
&& matches!(fields[0], "100644" | "100755")
&& fields[1] == "blob"
&& commit_id(fields[2])
&& fields[3]
.parse::<usize>()
.is_ok_and(|size| size <= MAX_CONTEXT_FILE_BYTES),
"Pinned source is missing, non-regular or exceeds the context limit"
);
let source = run_command(
workspace,
Program::Git,
&["cat-file".into(), "blob".into(), fields[2].into()],
)?;
anyhow::ensure!(
source.len() <= MAX_CONTEXT_FILE_BYTES && !source.contains('\0'),
"Pinned source is not bounded text"
);
Ok(source)
}
fn read_bounded(reader: impl Read, limit: usize) -> std::io::Result<Vec<u8>> {
let mut bytes = Vec::new();
reader.take(limit as u64 + 1).read_to_end(&mut bytes)?;
Ok(bytes)
}
fn run_command(workspace: &Path, program: Program, args: &[String]) -> Result<String> {
let mut command = match program {
Program::Gh => Gh::command().context("PR review requires GitHub CLI on PATH")?,
Program::Git => Git::review_command(workspace)?,
};
commandView on GitHub (pinned to 73e0f67d83)