{"record":{"id":"820885135ba16a33","repo":"abhigyanpatwari/GitNexus","slug":"evidence-exceeds-the-per-file-limit-name","errorCode":null,"errorMessage":"evidence exceeds the per-file limit: {name}","messagePattern":"evidence exceeds the per-file limit: (.+?)","errorType":"exception","errorClass":"SandboxError","httpStatus":null,"severity":"error","filePath":"eval/workflow_bench/proposer_sandbox.py","lineNumber":233,"sourceCode":"    *,\n    secrets: Sequence[str] = (),\n) -> Path:\n    \"\"\"Write a redacted owner-only evidence bundle with hard byte caps.\"\"\"\n\n    destination = destination.resolve()\n    if destination.exists():\n        raise SandboxError(f\"evidence destination already exists: {destination}\")\n    destination.mkdir(parents=True, mode=0o700)\n    destination.chmod(0o700)\n    total = 0\n    try:\n        for name, value in entries.items():\n            relative = PurePosixPath(name)\n            if len(relative.parts) != 1 or relative.name in {\"\", \".\", \"..\"}:\n                raise SandboxError(f\"evidence names must be simple relative files: {name!r}\")\n            payload = _evidence_bytes(value, secrets)\n            if len(payload) > MAX_EVIDENCE_FILE_BYTES:\n                raise SandboxError(f\"evidence exceeds the per-file limit: {name}\")\n            total += len(payload)\n            if total > MAX_BUNDLE_BYTES:\n                raise SandboxError(\"evidence bundle exceeds the total byte limit\")\n            path = destination / relative.name\n            path.write_bytes(payload)\n            path.chmod(0o600)\n    except BaseException:\n        shutil.rmtree(destination, ignore_errors=True)\n        raise\n    return destination\n\n\ndef _validated_base_url(base_url: str) -> str:\n    value = base_url.strip()\n    parsed = urlsplit(value)\n    if (\n        parsed.scheme not in {\"http\", \"https\"}\n        or not parsed.hostname","sourceCodeStart":215,"sourceCodeEnd":251,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/d540b00184d71a896261ee02670da9a92d59d8f7/eval/workflow_bench/proposer_sandbox.py#L215-L251","documentation":"Raised by stage_evidence_bundle after _evidence_bytes returns, when the redacted payload length itself exceeds MAX_EVIDENCE_FILE_BYTES (256 KiB). This is the post-redaction, in-memory cap applied to all entry types (Path, bytes, str, json), distinct from [422] which checks the on-disk Path size before redaction. It catches the case where bytes/str/json input or redacted output is oversized.","triggerScenarios":"A non-Path entry (bytes/str/JSON-serialized object) whose redacted form is larger than 262144 bytes, or a Path whose redacted text grew to exceed the cap despite a smaller raw size (rare) — primarily the bytes/str/json branches.","commonSituations":"A large stdout/stderr captured as str and passed directly; a big dict/JSON object serialized via json.dumps; base64 or hex blob that survives redaction; caller assumed the cap applied only to files and passed a huge string.","solutions":["Truncate the string/bytes before staging: payload[:MAX_EVIDENCE_FILE_BYTES] or keep the meaningful tail.","Stream-extract the relevant slice from the source data rather than staging the whole thing.","If you must capture more, split into multiple entries each under the cap.","For JSON, project to only the fields you need before serialization."],"exampleFix":"// before\nstage_evidence_bundle(dest, {\"stdout\": huge_stdout})  # str, >256 KiB\n// after\ncapped = huge_stdout[-MAX_EVIDENCE_FILE_BYTES:] if len(huge_stdout) > MAX_EVIDENCE_FILE_BYTES else huge_stdout\nstage_evidence_bundle(dest, {\"stdout\": capped})","handlingStrategy":"validation","validationCode":"from eval.workflow_bench.proposer_sandbox import MAX_EVIDENCE_FILE_BYTES\n\ndef capped(value):\n    if isinstance(value, (bytes, bytearray)):\n        return bytes(value[:MAX_EVIDENCE_FILE_BYTES])\n    if isinstance(value, str):\n        return value[:MAX_EVIDENCE_FILE_BYTES]\n    return value\n\nentries = {k: capped(v) for k, v in entries.items()}","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 'name' in str(exc):\n        # 425 path: post-redaction oversize on bytes/str/json\n        entries = {k: capped(v) for k, v in entries.items()}\n        stage_evidence_bundle(dest, entries, secrets=secrets)\n    raise","preventionTips":["Tail or head large strings before staging.","Project large JSON to only the needed fields.","Avoid passing raw captured stdout; pass the trimmed slice.","Keep a helper that caps any value to MAX_EVIDENCE_FILE_BYTES."],"tags":["evidence","size-limit","validation","sandbox"],"backgroundTag":null,"analyzedSha":"d540b00184d71a896261ee02670da9a92d59d8f7","analyzedAt":"2026-08-12T19:50:25.132Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}