{"record":{"id":"cfb9e1416285efb4","repo":"abhigyanpatwari/GitNexus","slug":"workspace-snapshot-exceeds-its-bounded-entry-or-pa","errorCode":null,"errorMessage":"workspace snapshot exceeds its bounded entry or path limit","messagePattern":"workspace snapshot exceeds its bounded entry or path limit","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"warning","filePath":"eval/workflow_bench/runner_artifacts.py","lineNumber":151,"sourceCode":"    pending: list[tuple[Path, PurePosixPath]] = [(root, PurePosixPath())]\n    entry_count = 0\n    path_bytes = 0\n    file_bytes = 0\n    nofollow = getattr(os, \"O_NOFOLLOW\", 0)\n    while pending:\n        directory, relative_dir = pending.pop()\n        try:\n            children = sorted(os.scandir(directory), key=lambda entry: entry.name, reverse=True)\n        except OSError as exc:\n            raise ValueError(f\"workspace snapshot directory is unreadable: {directory}: {exc}\") from exc\n        for entry in children:\n            relative = relative_dir / entry.name\n            if _is_bootstrap_noise(relative):\n                continue\n            entry_count += 1\n            path_bytes += len(relative.as_posix().encode())\n            if entry_count > MAX_WORKSPACE_SNAPSHOT_ENTRIES or path_bytes > MAX_WORKSPACE_SNAPSHOT_PATH_BYTES:\n                raise ValueError(\"workspace snapshot exceeds its bounded entry or path limit\")\n            metadata = entry.stat(follow_symlinks=False)\n            permissions = stat.S_IMODE(metadata.st_mode)\n            if stat.S_ISDIR(metadata.st_mode):\n                snapshot[relative.as_posix()] = f\"d:{permissions:o}\"\n                pending.append((Path(entry.path), relative))\n                continue\n            if stat.S_ISLNK(metadata.st_mode):\n                snapshot[relative.as_posix()] = f\"l:{permissions:o}:{os.readlink(entry.path)}\"\n                continue\n            if not stat.S_ISREG(metadata.st_mode):\n                snapshot[relative.as_posix()] = f\"s:{metadata.st_mode}\"\n                continue\n            file_bytes += metadata.st_size\n            if file_bytes > MAX_WORKSPACE_SNAPSHOT_FILE_BYTES:\n                raise ValueError(\"workspace snapshot exceeds its bounded file-byte limit\")\n            descriptor = os.open(entry.path, os.O_RDONLY | nofollow)\n            try:\n                opened = os.fstat(descriptor)","sourceCodeStart":133,"sourceCodeEnd":169,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/d540b00184d71a896261ee02670da9a92d59d8f7/eval/workflow_bench/runner_artifacts.py#L133-L169","documentation":"Raised in workspace_snapshot (runner_artifacts.py:151) when the number of entries exceeds MAX_WORKSPACE_SNAPSHOT_ENTRIES (100_000) or the cumulative relative-path byte length exceeds MAX_WORKSPACE_SNAPSHOT_PATH_BYTES (16 MiB). The bound exists so a pathological workspace (huge node_modules, generated corpus) cannot make the phase-boundary snapshot unbounded in time or memory.","triggerScenarios":"The worktree contains more than 100k tracked entries (after .git and bootstrap-noise exclusion) or >16 MiB of path strings. Common with a deeply nested vendored dependency tree, a generated coverage/ directory, or a task setup that vendors a large SDK into the worktree.","commonSituations":"Task setup runs npm install into the worktree adding 200k node_modules entries; a corpus fixture checked into the repo; a build step emitting thousands of .o files; benchmarking a monorepo with many packages.","solutions":["Reduce workspace footprint: exclude generated/vendored trees from the worktree by adding them to a .gitignore so the clone is lean, or run the snapshot before vendoring.","If the large tree is legitimate, raise MAX_WORKSPACE_SNAPSHOT_ENTRIES / MAX_WORKSPACE_SNAPSHOT_PATH_BYTES in runner_artifacts.py (note the snapshot is O(n) at every phase boundary).","Move bulky generated artifacts to a directory outside the worktree that the snapshot does not walk."],"exampleFix":"// before: npm install bloats the worktree past 100k entries\nsetup: npm install\n\n// after: install outside the hashed worktree, or add to .gitignore\necho 'node_modules/' >> .gitignore\n# and install into a sibling dir referenced by NODE_PATH","handlingStrategy":"validation","validationCode":"from pathlib import Path\nfrom eval.workflow_bench.runner_artifacts import MAX_WORKSPACE_SNAPSHOT_ENTRIES, MAX_WORKSPACE_SNAPSHOT_PATH_BYTES\n\ndef estimate_snapshot_cost(root: Path) -> tuple[int, int]:\n    entries = 0\n    path_bytes = 0\n    for p in Path(root).rglob(\"*\"):\n        rel = p.relative_to(root).as_posix()\n        if rel.startswith(\".git/\"):\n            continue\n        entries += 1\n        path_bytes += len(rel.encode())\n    return entries, path_bytes\n\nentries, path_bytes = estimate_snapshot_cost(worktree)\nassert entries <= MAX_WORKSPACE_SNAPSHOT_ENTRIES, f\"{entries} entries > limit\"\nassert path_bytes <= MAX_WORKSPACE_SNAPSHOT_PATH_BYTES, f\"{path_bytes} path bytes > limit\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep vendored/generated trees (node_modules, dist, build) out of the cloned worktree or under a .gitignored path.","Estimate entry/path-byte cost before running the benchmark on large repos.","Raise the constants in runner_artifacts.py only after confirming the snapshot time is acceptable."],"tags":["limits","workspace-snapshot","filesystem"],"backgroundTag":null,"analyzedSha":"d540b00184d71a896261ee02670da9a92d59d8f7","analyzedAt":"2026-08-12T19:50:25.132Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}