{"record":{"id":"ae2a7e3c48b12019","repo":"abhigyanpatwari/GitNexus","slug":"evidence-exceeds-the-per-file-limit-value","errorCode":null,"errorMessage":"evidence exceeds the per-file limit: {value}","messagePattern":"evidence exceeds the per-file limit: (.+?)","errorType":"exception","errorClass":"SandboxError","httpStatus":null,"severity":"error","filePath":"eval/workflow_bench/proposer_sandbox.py","lineNumber":200,"sourceCode":"    for secret in secrets:\n        if secret:\n            text = text.replace(secret, \"[REDACTED]\")\n    text = _TOKEN_PATTERNS[0].sub(\"[REDACTED]\", text)\n    text = _TOKEN_PATTERNS[1].sub(\"[REDACTED]\", text)\n    text = _TOKEN_PATTERNS[2].sub(r\"\\1[REDACTED]\", text)\n    return _TOKEN_PATTERNS[3].sub(r\"\\1[REDACTED]@\", text)\n\n\ndef _evidence_bytes(value: Any, secrets: Sequence[str]) -> bytes:\n    if isinstance(value, Path):\n        try:\n            mode = value.lstat().st_mode\n        except OSError as exc:\n            raise SandboxError(f\"evidence path is unreadable: {value}: {exc}\") from exc\n        if value.is_symlink() or not stat.S_ISREG(mode):\n            raise SandboxError(f\"evidence must be a regular non-symlink file: {value}\")\n        if value.stat().st_size > MAX_EVIDENCE_FILE_BYTES:\n            raise SandboxError(f\"evidence exceeds the per-file limit: {value}\")\n        raw = value.read_bytes()\n        return redact_text(raw.decode(errors=\"replace\"), secrets).encode()\n    if isinstance(value, bytes):\n        raw = value\n    elif isinstance(value, str):\n        raw = value.encode()\n    else:\n        raw = (json.dumps(value, sort_keys=True, separators=(\",\", \":\")) + \"\\n\").encode()\n    return redact_text(raw.decode(errors=\"replace\"), secrets).encode()\n\n\ndef stage_evidence_bundle(\n    destination: Path,\n    entries: Mapping[str, Any],\n    *,\n    secrets: Sequence[str] = (),\n) -> Path:\n    \"\"\"Write a redacted owner-only evidence bundle with hard byte caps.\"\"\"","sourceCodeStart":182,"sourceCodeEnd":218,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/d540b00184d71a896261ee02670da9a92d59d8f7/eval/workflow_bench/proposer_sandbox.py#L182-L218","documentation":"Raised by _evidence_bytes when a Path evidence file's on-disk size (value.stat().st_size, pre-redaction) exceeds MAX_EVIDENCE_FILE_BYTES (256 KiB). The cap is enforced before read_bytes() so a huge file is never read into memory or scanned for secrets.","triggerScenarios":"stage_evidence_bundle receives a Path entry whose actual file size is greater than 262144 bytes.","commonSituations":"A full run log or stdout capture was attached untrimmed; an oracle dumped a large JSON snapshot; binary artifact (screenshot, core file) mistakenly staged; verbose tracing left on; a build output file was selected instead of the trimmed summary.","solutions":["Trim or tail the file to fit: keep the last 256 KiB (or the meaningful slice) and stage that, as eval/workflow_bench/evolve.py:_bounded_regular_text already does.","Switch the entry from Path to bytes/str containing only the excerpt you need.","If the file legitimately needs full capture, split it across multiple <=256 KiB entries (each still capped) or raise MAX_EVIDENCE_FILE_BYTES deliberately with a code change after review.","Filter the content before staging (e.g. strip base64 blobs, drop noisy lines)."],"exampleFix":"// before\nstage_evidence_bundle(dest, {\"run.log\": Path(\"run.log\")})  # run.log is 2 MiB\n// after\nbounded = _bounded_regular_text(Path(\"run.log\"), limit=MAX_EVIDENCE_FILE_BYTES)\nstage_evidence_bundle(dest, {\"run.log\": bounded})","handlingStrategy":"validation","validationCode":"from pathlib import Path\nfrom eval.workflow_bench.proposer_sandbox import MAX_EVIDENCE_FILE_BYTES\n\ndef fits_per_file(p: Path) -> bool:\n    try:\n        return p.stat().st_size <= MAX_EVIDENCE_FILE_BYTES\n    except OSError:\n        return False\n\nentries = {k: v for k, v in entries.items() if not isinstance(v, Path) or fits_per_file(v)}","typeGuard":"null","tryCatchPattern":"try:\n    stage_evidence_bundle(dest, entries, secrets=secrets)\nexcept SandboxError as exc:\n    if 'per-file limit' in str(exc) and 'value' in str(exc):\n        # 422 path: trim the oversized file and retry\n        trim_oversized_path_entries(entries)\n        stage_evidence_bundle(dest, entries, secrets=secrets)\n    raise","preventionTips":["Pre-trim logs with a bounded-text helper (see _bounded_regular_text).","Cap stdout/stderr capture at the source to <= 256 KiB.","Avoid attaching binary artifacts; stage summaries instead.","Log each entry's size before staging for fast diagnosis."],"tags":["evidence","size-limit","filesystem","sandbox"],"backgroundTag":null,"analyzedSha":"d540b00184d71a896261ee02670da9a92d59d8f7","analyzedAt":"2026-08-12T19:50:25.132Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}