abhigyanpatwari/GitNexus · critical · SandboxError

sandbox_copy {role}: {relative}

Error message

sandbox_copy {role}: {relative}

What it means

_preflight_exact_root walks the destination clone along a declared root and refuses if any component is a symlink. {role} is 'target cannot be a symlink' for the final component or 'target has a symlink parent' for an intermediate one. This protects the publish step from replacing — or being redirected by — a symlink already present in the clone.

Source

Thrown at eval/workflow_bench/task_assets.py:707

        except (OSError, RuntimeError, ValueError) as exc:
            raise SandboxError(f"dependency symlink is dangling or escapes its snapshot: {entry.path}") from exc


def _preflight_exact_root(clone: Path, relative: PurePosixPath) -> None:
    """Reject symlink/special hazards while permitting replaceable type conflicts."""

    flags = os.O_RDONLY | os.O_DIRECTORY | getattr(os, "O_CLOEXEC", 0) | getattr(os, "O_NOFOLLOW", 0)
    current = os.open(clone, flags)
    try:
        for index, part in enumerate(relative.parts):
            try:
                mode = os.stat(part, dir_fd=current, follow_symlinks=False).st_mode
            except FileNotFoundError:
                return
            last = index == len(relative.parts) - 1
            if stat.S_ISLNK(mode):
                role = "target cannot be a symlink" if last else "target has a symlink parent"
                raise SandboxError(f"sandbox_copy {role}: {relative}")
            if last:
                if not (stat.S_ISDIR(mode) or stat.S_ISREG(mode)):
                    raise SandboxError(f"sandbox_copy target has an unsupported type: {relative}")
                return
            if stat.S_ISREG(mode):
                return
            if not stat.S_ISDIR(mode):
                raise SandboxError(f"sandbox_copy target parent has an unsupported type: {relative}")
            next_descriptor = os.open(part, flags, dir_fd=current)
            os.close(current)
            current = next_descriptor
    finally:
        os.close(current)


def _open_publish_parent(clone: Path, parent: PurePosixPath) -> int:
    flags = os.O_RDONLY | os.O_DIRECTORY | getattr(os, "O_CLOEXEC", 0) | getattr(os, "O_NOFOLLOW", 0)
    current = os.open(clone, flags)

View on GitHub (pinned to d540b00184)

Solutions

  1. Use a fresh clone per run, or reset it (`git -C <clone> checkout -f && git -C <clone> clean -fdx`) before materializing
  2. Remove the conflicting symlink at the reported path manually
  3. Avoid declaring roots that intentionally collide with symlinks
Defensive patterns

Strategy: validation

Validate before calling

import os, stat
from pathlib import Path

def clone_root_is_clean(clone: Path, declarations: list[str]) -> list[str]:
    bad = []
    for decl in declarations:
        parts = Path(decl).parts
        walker = clone
        for i, part in enumerate(parts):
            walker = walker / part
            try:
                m = walker.lstat().st_mode
            except FileNotFoundError:
                break
            if stat.S_ISLNK(m):
                bad.append(f"{decl} (symlink at {walker})"); break
    return bad
# run before TaskAssetSnapshot.materialize(clone)

Try / catch

from eval.workflow_bench.proposer_sandbox import SandboxError

try:
    snapshot.materialize(clone)
except SandboxError as exc:
    if "cannot be a symlink" in str(exc) or "symlink parent" in str(exc):
        raise SystemExit(f"clone has a symlink on a declared root; reset the clone: {exc}") from exc
    raise

Prevention

When it happens

Trigger: A pre-existing symlink in the clone at a declared sandbox_copy root path; a prior arm left a symlink where the snapshot expects to publish a real directory or file.

Common situations: A clone reused across runs accumulates symlinks; the repo itself contains symlinks at the declared root paths that the snapshot intends to overwrite.

Related errors


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