abhigyanpatwari/GitNexus · error · SandboxError

Compound Engineering plugin exceeds the file-count limit

Error message

Compound Engineering plugin exceeds the file-count limit

What it means

File-count guard in _build_ce_plugin_snapshot. The plugin may contain at most MAX_CE_PLUGIN_FILES (2048) entries; once that many have been admitted, the next file triggers this error and aborts the snapshot. The bound keeps snapshot materialization and the manifest finite.

Source

Thrown at eval/workflow_bench/runtime_mounts.py:430

        for name in files:
            (Path(directory) / name).chmod(0o600)
        Path(directory).chmod(0o700)
    shutil.rmtree(root)


def _build_ce_plugin_snapshot(config: CePluginConfig, destination_parent: Path) -> CePluginSnapshot:
    parent = _validated_runtime_root(destination_parent, label="CE plugin snapshot parent")
    root = Path(tempfile.mkdtemp(prefix="wfbench-ce-plugin-", dir=parent))
    root.chmod(0o700)
    entries: list[dict[str, Any]] = []
    total_bytes = 0
    try:
        for relative, source in _plugin_files(config.source):
            relative_text = relative.as_posix()
            if len(relative_text.encode()) > MAX_CE_PLUGIN_PATH_BYTES:
                raise SandboxError(f"Compound Engineering plugin path exceeds the byte limit: {relative_text}")
            if len(entries) >= MAX_CE_PLUGIN_FILES:
                raise SandboxError("Compound Engineering plugin exceeds the file-count limit")
            payload, executable = _bounded_plugin_bytes(source)
            total_bytes += len(payload)
            if total_bytes > MAX_CE_PLUGIN_TOTAL_BYTES:
                raise SandboxError("Compound Engineering plugin exceeds the total byte limit")
            _write_snapshot_file(
                root / Path(*relative.parts),
                payload,
                executable=executable,
            )
            entries.append(
                {
                    "path": relative_text,
                    "sha256": hashlib.sha256(payload).hexdigest(),
                    "size": len(payload),
                    "executable": executable,
                }
            )

View on GitHub (pinned to d540b00184)

Solutions

  1. Count files: 'find <plugin_dir> -type f | wc -l' and prune the largest contributors (usually node_modules or dist).
  2. Add the plugin's own .gitignore-style exclusion so build output is not snapshotted; clean before running.
  3. Vendor only the runtime files the skill executes, not the full dependency closure.
  4. Split the plugin into multiple versioned releases if it legitimately needs more files.

Example fix

# before
find ce-plugin -type f | wc -l   # 5300 (includes node_modules)
# after
rm -rf ce-plugin/**/node_modules
find ce-plugin -type f | wc -l   # 410
Defensive patterns

Strategy: validation

Validate before calling

from pathlib import Path

MAX_FILES = 2048
plugin = Path("ce-plugin")
count = sum(1 for p in plugin.rglob("*") if p.is_file())
if count > MAX_FILES:
    raise SystemExit(f"plugin has {count} files; limit is {MAX_FILES}")

Type guard

MAX_CE_PLUGIN_FILES = 2048

def file_count_within_bound(count: int) -> bool:
    return count <= MAX_CE_PLUGIN_FILES

Try / catch

try:
    snapshot = _build_ce_plugin_snapshot(config, destination_parent)
except SandboxError as exc:
    if "file-count limit" in str(exc):
        log.error("plugin has > 2048 files; prune node_modules/dist")
    raise

Prevention

When it happens

Trigger: The plugin tree under skills/scripts/assets + .claude-plugin contains more than 2048 files. Common producers: a vendored node_modules folder, a checked-in dist tree with many chunks, a corpus of fixtures, generated per-test artifacts.

Common situations: Shipping node_modules or a compiled output tree inside the plugin; committing a large fixture set; bundling per-language grammar files.

Related errors


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