abhigyanpatwari/GitNexus · error · SandboxError

sandbox_copy target parent has an unsupported type: {parent}

Error message

sandbox_copy target parent has an unsupported type: {parent}

What it means

_open_publish_parent treats an intermediate component as replaceable only if it is a regular file (it unlinks the file and mkdirs in its place). Any other non-directory type (FIFO, socket, device) is rejected because the remover cannot safely delete it.

Source

Thrown at eval/workflow_bench/task_assets.py:736

            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)
    try:
        for part in parent.parts:
            try:
                mode = os.stat(part, dir_fd=current, follow_symlinks=False).st_mode
            except FileNotFoundError:
                mode = None
            if mode is not None and stat.S_ISLNK(mode):
                raise SandboxError(f"sandbox_copy target cannot traverse a symlink: {parent}")
            if mode is not None and not stat.S_ISDIR(mode):
                if not stat.S_ISREG(mode):
                    raise SandboxError(f"sandbox_copy target parent has an unsupported type: {parent}")
                os.unlink(part, dir_fd=current)
                mode = None
            if mode is None:
                os.mkdir(part, mode=0o700, dir_fd=current)
            next_descriptor = os.open(part, flags, dir_fd=current)
            os.close(current)
            current = next_descriptor
        return current
    except BaseException:
        os.close(current)
        raise


def _open_existing_parent(root: Path, parent: PurePosixPath) -> int:
    flags = os.O_RDONLY | os.O_DIRECTORY | getattr(os, "O_CLOEXEC", 0) | getattr(os, "O_NOFOLLOW", 0)
    current = os.open(root, flags)
    try:
        for part in parent.parts:

View on GitHub (pinned to d540b00184)

Solutions

  1. Locate: `find <clone> -xdev ! -type d ! -type f -print` and remove the entries
  2. Reset the clone: `git -C <clone> clean -fdx`
  3. Ensure no tool creates such entries before materialize runs
Defensive patterns

Strategy: validation

Validate before calling

import os, stat
from pathlib import Path

def non_replaceable_parents(clone: Path, declarations: list[str]) -> list[str]:
    bad = []
    for decl in declarations:
        for parent in Path(decl).parents:
            p = clone / parent
            try:
                m = p.lstat().st_mode
            except FileNotFoundError:
                continue
            if not (stat.S_ISDIR(m) or stat.S_ISREG(m)):
                bad.append(str(p))
    return bad

Try / catch

from eval.workflow_bench.proposer_sandbox import SandboxError

try:
    snapshot.materialize(clone)
except SandboxError as exc:
    if "parent has an unsupported type" in str(exc):
        raise SystemExit(f"non-replaceable special file in a parent path; reset the clone: {exc}") from exc
    raise

Prevention

When it happens

Trigger: A non-dir, non-regular-file entry sits at an intermediate parent path in the clone where the snapshot needs to create a directory.

Common situations: Stray IPC artifacts in the clone; a broken cleanup left a socket in a parent path; tooling created a special file before materialize.

Related errors


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