Hmbown/CodeWhale · error

Pinned source is missing, non-regular or exceeds the…

Error message

Pinned source is missing, non-regular or exceeds the context limit

What it means

`context_blob` resolves a pinned file's source blob via `git ls-tree` and validates the returned metadata: the path must match the requested one, the mode must be a regular executable-or-not file (100644/100755), the object type must be `blob`, and the object id must be a valid commit/blob id. Any deviation — missing path, submodule (commit object), symlink, or malformed listing — means the pinned source cannot be safely read.

Solutions

  1. Skip non-regular pinned entries (symlinks/submodules) or resolve them explicitly before review
  2. Verify the requested path exists in the pinned commit's tree (`git ls-tree <commit> -- <path>`)
  3. Re-pin the review to a commit that actually contains the file as a regular blob

Example fix

// before
let src = context_blob(ws, pinned_commit, "docs/link.md")?;
// after
let mode = tree_entry_mode(ws, pinned_commit, "docs/link.md")?;
if !matches!(mode.as_str(), "100644" | "100755") {
    return Ok(None); // symlink or submodule: no bounded text source
}
let src = context_blob(ws, pinned_commit, "docs/link.md")?;
Defensive patterns

Strategy: validation

Validate before calling

let out = git(["ls-tree", commit, "--", path])?; let regular = out.starts_with("100644 ") || out.starts_with("100755 "); if !regular { skip_or_handle(path); }

Try / catch

match source_context(ws, commit, path) { Ok(src) => Some(src), Err(e) if e.to_string().contains("Pinned source") => { warn!("skipping non-regular pinned entry {path}"); None }, Err(e) => return Err(e) }

Prevention

When it happens

Trigger: Calling `source_context`/`context_blob` for a path that is a symlink (120000), a submodule (160000 commit), absent from the pinned tree, or whose `git ls-tree -z` output is malformed (wrong field count, path mismatch, invalid object id).

Common situations: Reviewing a PR that adds symlinks or submodules; a path containing tabs/odd characters mishandled by parsing; requesting a file that only exists in the working checkout, not the pinned commit; renamed/moved files queried by an old path.

Related errors


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

Appendix: source

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

    let listing = run_command(
        workspace,
        Program::Git,
        &[
            "--literal-pathspecs".into(),
            "ls-tree".into(),
            "--full-tree".into(),
            "-zl".into(),
            head_sha.into(),
            "--".into(),
            path.into(),
        ],
    )?;
    let (header, returned_path) = listing
        .trim_end_matches('\0')
        .split_once('\t')
        .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"

View on GitHub (pinned to 73e0f67d83)