abhigyanpatwari/GitNexus · error · SandboxError

sandbox_copy exceeds the entry limit

Error message

sandbox_copy exceeds the entry limit

What it means

Raised by _SnapshotBuilder._record when the shared budget's entry count has reached MAX_TASK_ASSET_ENTRIES (100,000) and a new unique manifest entry would be added. This is a containment limit preventing a declaration from turning snapshot preparation into an unbounded walk over a pathological tree (e.g. a huge generated directory or a misdeclared vendor root). It counts distinct recorded paths, including auto-created parent directories.

Source

Thrown at eval/workflow_bench/task_assets.py:523

        for part in relative.parts:
            current /= part
            existing = self.entries.get(current)
            if existing is not None:
                if existing.kind != "directory":
                    raise SandboxError(f"sandbox_copy paths collide at {current}")
                continue
            self._record(AssetManifestEntry(path=current, kind="directory"))
            (self.destination / Path(*current.parts)).mkdir(mode=0o700, exist_ok=True)

    def _record(self, entry: AssetManifestEntry) -> None:
        _validate_manifest_path(entry.path)
        existing = self.entries.get(entry.path)
        if existing is not None:
            if existing != entry:
                raise SandboxError(f"sandbox_copy paths collide at {entry.path}")
            return
        if self.budget.entries >= MAX_TASK_ASSET_ENTRIES:
            raise SandboxError("sandbox_copy exceeds the entry limit")
        self.entries[entry.path] = entry
        self.budget.entries += 1

    def ensure_directory(self, relative: PurePosixPath) -> None:
        """Record and create one extra directory inside this snapshot.

        Used for harness-owned mount points that must exist in the captured
        bytes rather than be created against a read-only bind at runtime.
        """

        self._record_directory(relative)

    def finished_entries(self) -> tuple[AssetManifestEntry, ...]:
        return tuple(sorted(self.entries.values(), key=lambda entry: entry.path.as_posix()))


def _sandbox_copy_declarations(
    task: Mapping[str, Any],

View on GitHub (pinned to d540b00184)

Solutions

  1. Narrow the declaration to the specific files or subdirectories needed: avoid declaring repo roots or whole node_modules trees.
  2. Count entries first: `find <declared-root> -mindepth 1 | wc -l` — if it exceeds ~95k, trim.
  3. Move large generated trees out of the captured snapshot and regenerate them inside the arm clone.
  4. For dependencies, prefer read-only binds of curated node_modules rather than copying sprawling vendor trees.

Example fix

// before — declaring an entire repo root
{"sandbox_copy": ["."]}

// after — declare only what the task reads
{"sandbox_copy": ["src", "tests", "package.json"]}
Defensive patterns

Strategy: validation

Validate before calling

from pathlib import Path
import os

MAX_ENTRIES = 100_000

def count_declared_entries(repo: Path, declarations: list[str]) -> int:
    n = 0
    for raw in declarations:
        root = repo / raw
        for current, dirs, files in os.walk(root, followlinks=False):
            n += len(dirs) + len(files)
            if n > MAX_ENTRIES:
                return n
    return n

count = count_declared_entries(repo_path, task["sandbox_copy"])
if count > MAX_ENTRIES:
    raise ValueError(f"sandbox_copy declares {count} entries, limit is {MAX_ENTRIES}")

Try / catch

from eval.workflow_bench.propposer_sandbox import SandboxError

try:
    snapshot = cache.prepare(task, repo=repo, resolved_sha=sha)
except SandboxError as exc:
    if "exceeds the entry limit" in str(exc):
        # narrow declarations to the specific subtree needed
        raise
    raise

Prevention

When it happens

Trigger: A declared sandbox_copy or sandbox_dependency source tree contains more than 100,000 distinct files plus directories. Common with a full `node_modules` of a large monorepo, a vendored dataset of many small files, or an accidentally-declared repo root that includes `.git/objects`.

Common situations: Declaring the entire repo root as sandbox_copy. Declaring a node_modules containing hundreds of packages with thousands of transitive files. A generated test corpus (property-based test outputs, fuzzing seeds) exceeding the entry ceiling.

Related errors


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