abhigyanpatwari/GitNexus · error · SandboxError

sandbox dependency targets overlap: {declaration.target} and

Error message

sandbox dependency targets overlap: {declaration.target} and {other.target}

What it means

Raised by _sandbox_dependency_declarations during a pairwise comparison of all dependency declarations: if any two share the same target, or one target is an ancestor of the other, the targets overlap and are rejected. Two dependencies mounting at overlapping clone paths would contest ownership of the mount point, so the harness requires disjoint targets. Only targets are checked — sources may overlap because the same source can back distinct mount points.

Source

Thrown at eval/workflow_bench/task_assets.py:600

            raise SandboxError(f"dependency target must stay inside the clone: {target_path}")
        _validate_manifest_path(source_path)
        _validate_manifest_path(target_path)
        declarations.append(
            _DependencyDeclaration(
                source=source,
                target=target,
                source_path=source_path,
                target_path=target_path,
            )
        )
    for index, declaration in enumerate(declarations):
        for other in declarations[index + 1 :]:
            if (
                declaration.target_path == other.target_path
                or declaration.target_path in other.target_path.parents
                or other.target_path in declaration.target_path.parents
            ):
                raise SandboxError(f"sandbox dependency targets overlap: {declaration.target} and {other.target}")
    return tuple(declarations)


def _open_relative(repo_descriptor: int, relative: PurePosixPath) -> int:
    current = os.dup(repo_descriptor)
    try:
        for index, part in enumerate(relative.parts):
            last = index == len(relative.parts) - 1
            child = _open_child(current, part, PurePosixPath(*relative.parts[: index + 1]), require_directory=not last)
            os.close(current)
            current = child
        return current
    except BaseException:
        os.close(current)
        raise


def _open_child(

View on GitHub (pinned to d540b00184)

Solutions

  1. Ensure each dependency has a unique, non-overlapping target path; merge sources that map to the same target.
  2. If a parent target covers a child, declare only the parent.
  3. Sort and review targets: `sorted(d['target'] for d in deps)` and check for nesting.
  4. Validate with the provided overlap guard before prepare() (see validationCode).

Example fix

// before
{"sandbox_dependencies": [
  {"source": "a/node_modules", "target": "node_modules"},
  {"source": "b/node_modules", "target": "node_modules"}
]}

// after — merge into one source
{"sandbox_dependencies": [
  {"source": "node_modules", "target": "node_modules"}
]}
Defensive patterns

Strategy: validation

Validate before calling

from pathlib import PurePosixPath

def validate_no_target_overlap(task: dict) -> None:
    targets = [PurePosixPath(d["target"]) for d in task.get("sandbox_dependencies", [])]
    for i, a in enumerate(targets):
        for b in targets[i+1:]:
            if a == b or a in b.parents or b in a.parents:
                raise ValueError(f"dependency targets overlap: {a} and {b}")

validate_no_target_overlap(task)

Type guard

from pathlib import PurePosixPath

def dependency_targets_are_disjoint(deps: list[dict]) -> bool:
    ts = [PurePosixPath(d["target"]) for d in deps]
    for i, a in enumerate(ts):
        for b in ts[i+1:]:
            if a == b or a in b.parents or b in a.parents:
                return False
    return True

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 "dependency targets overlap" in str(exc):
        # merge sources mapping to the same target, or drop nested targets
        raise
    raise

Prevention

When it happens

Trigger: Two dependencies with the same target (`node_modules` twice), or targets where one is a parent of the other (`node_modules` and `node_modules/foo`). The check is on target_path equality or ancestry in either direction.

Common situations: Merging dependency lists from multiple tasks without de-duplicating targets. Mounting two different sources at the same target by mistake. Mounting a parent and a child path (e.g. `node_modules` and `node_modules/.vite-temp`) when only the parent is needed.

Related errors


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