abhigyanpatwari/GitNexus · error · SandboxError

evidence bundle exceeds the total byte limit

Error message

evidence bundle exceeds the total byte limit

What it means

Raised by stage_evidence_bundle when the running total of staged (redacted) payload bytes exceeds MAX_BUNDLE_BYTES (2 MiB). Each entry's payload length is added to a cumulative total and the check fires after the per-file cap, so the whole bundle is bounded at 2 MiB regardless of how many entries.

Source

Thrown at eval/workflow_bench/proposer_sandbox.py:236

    """Write a redacted owner-only evidence bundle with hard byte caps."""

    destination = destination.resolve()
    if destination.exists():
        raise SandboxError(f"evidence destination already exists: {destination}")
    destination.mkdir(parents=True, mode=0o700)
    destination.chmod(0o700)
    total = 0
    try:
        for name, value in entries.items():
            relative = PurePosixPath(name)
            if len(relative.parts) != 1 or relative.name in {"", ".", ".."}:
                raise SandboxError(f"evidence names must be simple relative files: {name!r}")
            payload = _evidence_bytes(value, secrets)
            if len(payload) > MAX_EVIDENCE_FILE_BYTES:
                raise SandboxError(f"evidence exceeds the per-file limit: {name}")
            total += len(payload)
            if total > MAX_BUNDLE_BYTES:
                raise SandboxError("evidence bundle exceeds the total byte limit")
            path = destination / relative.name
            path.write_bytes(payload)
            path.chmod(0o600)
    except BaseException:
        shutil.rmtree(destination, ignore_errors=True)
        raise
    return destination


def _validated_base_url(base_url: str) -> str:
    value = base_url.strip()
    parsed = urlsplit(value)
    if (
        parsed.scheme not in {"http", "https"}
        or not parsed.hostname
        or parsed.username is not None
        or parsed.password is not None
        or parsed.query

View on GitHub (pinned to d540b00184)

Solutions

  1. Stage only the evidence the grader actually needs; drop redundant or duplicate artifacts.
  2. Drop the largest/lowest-value entries first until under 2 MiB.
  3. If the full set is required, run multiple bundles and reference them separately.
  4. Compress text-heavy content (gzip) before staging and note the encoding in the name.

Example fix

// before
stage_evidence_bundle(dest, {p.name: p for p in workspace.glob('**/*')})
// after
keep = [p for p in workspace.glob('**/*') if p.suffix in {'.log','.txt'}][:10]
stage_evidence_bundle(dest, {p.name: p for p in keep})
Defensive patterns

Strategy: validation

Validate before calling

from eval.workflow_bench.proposer_sandbox import MAX_BUNDLE_BYTES, MAX_EVIDENCE_FILE_BYTES

def total_size(entries) -> int:
    total = 0
    for v in entries.values():
        if isinstance(v, (bytes, bytearray)): total += len(v)
        elif isinstance(v, str): total += len(v)
        else: total += MAX_EVIDENCE_FILE_BYTES  # conservative estimate
    return total

if total_size(entries) > MAX_BUNDLE_BYTES:
    prune_to_fit(entries, MAX_BUNDLE_BYTES)

Type guard

null

Try / catch

try:
    stage_evidence_bundle(dest, entries, secrets=secrets)
except SandboxError as exc:
    if 'total byte limit' in str(exc):
        drop_largest_until_fits(entries, MAX_BUNDLE_BYTES)
        stage_evidence_bundle(dest, entries, secrets=secrets)
    raise

Prevention

When it happens

Trigger: Summing many <=256 KiB entries, or a few large ones, pushes the cumulative redacted byte count past 2097152.

Common situations: Staging every artifact greedily instead of a curated set; many test output files each near the per-file cap; a directory walk staged dozens of files; a retry that appended to a previously sized set without resetting.

Related errors


AI-assisted analysis of abhigyanpatwari/GitNexus@d540b00184 (2026-08-12). Data as JSON: /api/errors/182db2df46475073. Report an issue: GitHub.