abhigyanpatwari/GitNexus · warning · ValueError

workspace snapshot exceeds its bounded file-byte limit

Error message

workspace snapshot exceeds its bounded file-byte limit

What it means

Raised in workspace_snapshot (runner_artifacts.py:166) when the cumulative size of regular files exceeds MAX_WORKSPACE_SNAPSHOT_FILE_BYTES (1 GiB). The byte budget prevents hashing an unbounded volume of file content during phase-boundary checks; once exceeded the snapshot aborts rather than return a partial hash.

Source

Thrown at eval/workflow_bench/runner_artifacts.py:166

            entry_count += 1
            path_bytes += len(relative.as_posix().encode())
            if entry_count > MAX_WORKSPACE_SNAPSHOT_ENTRIES or path_bytes > MAX_WORKSPACE_SNAPSHOT_PATH_BYTES:
                raise ValueError("workspace snapshot exceeds its bounded entry or path limit")
            metadata = entry.stat(follow_symlinks=False)
            permissions = stat.S_IMODE(metadata.st_mode)
            if stat.S_ISDIR(metadata.st_mode):
                snapshot[relative.as_posix()] = f"d:{permissions:o}"
                pending.append((Path(entry.path), relative))
                continue
            if stat.S_ISLNK(metadata.st_mode):
                snapshot[relative.as_posix()] = f"l:{permissions:o}:{os.readlink(entry.path)}"
                continue
            if not stat.S_ISREG(metadata.st_mode):
                snapshot[relative.as_posix()] = f"s:{metadata.st_mode}"
                continue
            file_bytes += metadata.st_size
            if file_bytes > MAX_WORKSPACE_SNAPSHOT_FILE_BYTES:
                raise ValueError("workspace snapshot exceeds its bounded file-byte limit")
            descriptor = os.open(entry.path, os.O_RDONLY | nofollow)
            try:
                opened = os.fstat(descriptor)
                if (
                    not stat.S_ISREG(opened.st_mode)
                    or opened.st_dev != metadata.st_dev
                    or opened.st_ino != metadata.st_ino
                ):
                    raise ValueError(f"workspace file changed while opening: {entry.path}")
                digest = hashlib.sha256()
                while chunk := os.read(descriptor, 64 * 1024):
                    digest.update(chunk)
                after = os.fstat(descriptor)
                if (opened.st_size, opened.st_mtime_ns) != (after.st_size, after.st_mtime_ns):
                    raise ValueError(f"workspace file changed while hashing: {entry.path}")
            finally:
                os.close(descriptor)
            snapshot[relative.as_posix()] = f"f:{permissions:o}:{metadata.st_size}:{digest.hexdigest()}"

View on GitHub (pinned to d540b00184)

Solutions

  1. Identify the largest files: du -ah <worktree> | sort -rh | head. Move or .gitignore them so they are not in the cloned worktree.
  2. If large artifacts are inherent to the task, raise MAX_WORKSPACE_SNAPSHOT_FILE_BYTES in runner_artifacts.py and accept the longer snapshot time.
  3. Keep bulky assets in a directory the snapshot excludes (e.g. under a bootstrap-noise path) or symlink them from outside the worktree (note the snapshot records symlinks, not their targets).

Example fix

# before: dataset lives inside the hashed worktree
worktree/data/model.bin  # 2 GiB

# after: move it out and symlink (snapshot records the link, not the target)
mv worktree/data/model.bin /srv/models/model.bin
ln -s /srv/models/model.bin worktree/data/model.bin
Defensive patterns

Strategy: validation

Validate before calling

from pathlib import Path
from eval.workflow_bench.runner_artifacts import MAX_WORKSPACE_SNAPSHOT_FILE_BYTES

def estimate_file_bytes(root: Path) -> int:
    total = 0
    for p in Path(root).rglob("*"):
        if p.is_file() and not p.is_symlink():
            total += p.stat().st_size
    return total

total = estimate_file_bytes(worktree)
assert total <= MAX_WORKSPACE_SNAPSHOT_FILE_BYTES, f"{total} file bytes > 1 GiB limit"

Prevention

When it happens

Trigger: Sum of metadata.st_size across regular files in the walk passes 1 GiB before all files are hashed. Caused by large binary artifacts in the worktree: model weights, datasets, build outputs, or a vendored grammar prebuild.

Common situations: A task that downloads a multi-GB dataset into the worktree; a build step producing large .wasm/.so artifacts; checking in a model checkpoint; running against a repo with bundled media.

Related errors


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