{"record":{"id":"97dd083ebcdcc364","repo":"abhigyanpatwari/GitNexus","slug":"sandbox-copy-exceeds-the-path-byte-limit","errorCode":null,"errorMessage":"sandbox_copy exceeds the path byte limit","messagePattern":"sandbox_copy exceeds the path byte limit","errorType":"exception","errorClass":"SandboxError","httpStatus":null,"severity":"error","filePath":"eval/workflow_bench/task_assets.py","lineNumber":894,"sourceCode":"\ndef _mutation_identity(metadata: os.stat_result) -> tuple[int, int, int, int, int, int]:\n    return (\n        metadata.st_dev,\n        metadata.st_ino,\n        metadata.st_mode,\n        metadata.st_size,\n        metadata.st_mtime_ns,\n        metadata.st_ctime_ns,\n    )\n\n\ndef _validate_manifest_path(relative: PurePosixPath) -> None:\n    try:\n        path_bytes = len(relative.as_posix().encode(\"utf-8\"))\n    except UnicodeEncodeError as exc:\n        raise SandboxError(f\"sandbox_copy path is not valid UTF-8: {relative!s}\") from exc\n    if path_bytes > MAX_TASK_ASSET_PATH_BYTES:\n        raise SandboxError(\"sandbox_copy exceeds the path byte limit\")\n\n\ndef _manifest_digest(entries: tuple[AssetManifestEntry, ...]) -> str:\n    payload = [\n        {\n            \"kind\": entry.kind,\n            \"link_target\": entry.link_target,\n            \"mode\": entry.mode,\n            \"path\": entry.path.as_posix(),\n            \"sha256\": entry.sha256,\n            \"size\": entry.size,\n        }\n        for entry in entries\n    ]\n    return hashlib.sha256(json.dumps(payload, sort_keys=True, separators=(\",\", \":\")).encode()).hexdigest()\n\n\ndef _dependency_digests(dependencies: tuple[DependencySnapshot, ...]) -> tuple[str, str]:","sourceCodeStart":876,"sourceCodeEnd":912,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/d540b00184d71a896261ee02670da9a92d59d8f7/eval/workflow_bench/task_assets.py#L876-L912","documentation":"Raised by _validate_manifest_path when len(relative.as_posix().encode('utf-8')) exceeds MAX_TASK_ASSET_PATH_BYTES (4096, the Linux PATH_MAX). This is a containment guard so one pathological declaration cannot turn manifest/digest computation or the materialization walk into an unbounded or kernel-rejected operation.","triggerScenarios":"A sandbox_copy entry whose declared relative path is longer than 4096 bytes once UTF-8 encoded. Happens with deeply nested generated trees, hashed/bazel-style output paths, or a declaration that captures an absolute path with many components instead of a relative one.","commonSituations":"Pointing sandbox_copy at a node_modules/.cache or build output tree with very long paths; using full absolute repo paths instead of repo-relative ones; declaration globbing captured an unexpectedly deep generated directory.","solutions":["Shorten the declaration: use a repo-relative path and/or reorganize so the asset lives shallower in the tree.","If the long path is generated output, exclude it from sandbox_copy and regenerate it inside the clone instead.","Only raise MAX_TASK_ASSET_PATH_BYTES if you are certain every consumer (kernel, filesystem, JSON digest) accepts paths that long; 4096 is the safe portable ceiling."],"exampleFix":"# before: deeply nested generated path exceeds 4096 bytes\nsandbox_copy = ['src/gen/a0/b1/c2/.../very/deeply/nested/index.bin']\n\n# after: capture a shallower root and let the arm find the file under it\nsandbox_copy = ['src/gen']","handlingStrategy":"validation","validationCode":"from pathlib import PurePosixPath\n\nMAX_TASK_ASSET_PATH_BYTES = 4096\n\ndef assert_path_length(relative: PurePosixPath) -> None:\n    n = len(relative.as_posix().encode('utf-8'))\n    if n > MAX_TASK_ASSET_PATH_BYTES:\n        raise ValueError(f'sandbox_copy path exceeds {MAX_TASK_ASSET_PATH_BYTES} bytes: {relative}')\n\n# Validate every declared source/target before cache.prepare.","typeGuard":"def path_within_limit(relative: PurePosixPath, limit: int = 4096) -> bool:\n    return len(relative.as_posix().encode('utf-8')) <= limit","tryCatchPattern":null,"preventionTips":["Keep sandbox_copy declarations repo-relative and shallow.","Exclude deeply nested generated output (bazel/build caches) from sandbox_copy; regenerate in the clone.","Validate path byte length in task schema validation, before the asset module rejects at freeze time."],"tags":["validation","paths","limits","sandbox"],"backgroundTag":null,"analyzedSha":"d540b00184d71a896261ee02670da9a92d59d8f7","analyzedAt":"2026-08-12T19:50:25.132Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}