abhigyanpatwari/GitNexus · error · SandboxError

pinned GitNexus runtime component must be a real {kind}: {so

Error message

pinned GitNexus runtime component must be a real {kind}: {source}

What it means

Raised by _validated_runtime_component (runtime_mounts.py:165-168) when the component exists but is the wrong type or is a symlink: it is a symlink (S_ISLNK), its type does not match the expected kind (directory vs file), or resolve(strict=True) differs from source (a symlink hop in the path). The kind in the message is 'directory' or 'file' per the call site.

Source

Thrown at eval/workflow_bench/runtime_mounts.py:168

def _validated_runtime_component(
    root: Path,
    relative: str,
    target: str,
    *,
    directory: bool,
) -> ReadOnlyMount:
    """Validate one direct runtime component before exposing only that path."""

    source = root / relative
    try:
        mode = source.lstat().st_mode
        resolved = source.resolve(strict=True)
    except OSError as exc:
        raise SandboxError(f"pinned GitNexus runtime component is unavailable: {source}: {exc}") from exc
    expected_type = stat.S_ISDIR(mode) if directory else stat.S_ISREG(mode)
    if stat.S_ISLNK(mode) or not expected_type or resolved != source:
        kind = "directory" if directory else "file"
        raise SandboxError(f"pinned GitNexus runtime component must be a real {kind}: {source}")
    return ReadOnlyMount(source=source, target=target)


def trusted_gitnexus_runtime_mounts() -> tuple[ReadOnlyMount, ...]:
    """Expose only the files needed by the pinned CLI and linked shared package."""

    runtime = _validated_runtime_root(
        HARNESS_ROOT / "gitnexus",
        label="pinned GitNexus runtime",
    )
    shared = _validated_runtime_root(
        HARNESS_ROOT / "gitnexus-shared",
        label="pinned GitNexus shared runtime",
    )
    mounts = (
        _validated_runtime_component(
            runtime,
            "dist",

View on GitHub (pinned to d540b00184)

Solutions

  1. Replace the symlinked component with the real artifact (copy the directory/file into place).
  2. Run `realpath <source>` and ensure it equals the source path with no hop.
  3. For node_modules, use a real local install rather than a symlinked global store.
  4. Confirm the component kind matches expectation (dir vs file) at each call site.
Defensive patterns

Strategy: validation

Validate before calling

import stat
from pathlib import Path
source = Path(root) / relative
mode = source.lstat().st_mode
kind_ok = stat.S_ISDIR(mode) if expect_dir else stat.S_ISREG(mode)
if stat.S_ISLNK(mode) or not kind_ok or source.resolve(strict=True) != source:
    raise SystemExit(f"component must be a real {'directory' if expect_dir else 'file'}: {source}")

Type guard

import stat
from pathlib import Path
def component_is_real(root: str, relative: str, *, directory: bool) -> bool:
    source = Path(root) / relative
    try:
        mode = source.lstat().st_mode
        kind_ok = stat.S_ISDIR(mode) if directory else stat.S_ISREG(mode)
        return not stat.S_ISLNK(mode) and kind_ok and source.resolve(strict=True) == source
    except OSError:
        return False

Prevention

When it happens

Trigger: dist is a symlink to a build cache; node_modules is a symlinked global store; package.json is a symlink; a file path points at a directory or vice-versa; a component path includes a symlinked parent.

Common situations: pnpm/npm global link setups that symlink node_modules; monorepo workspaces surfacing symlinks; a directory replaced by a file or vice-versa after a partial build.

Related errors


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