abhigyanpatwari/GitNexus · error · SandboxError

pinned GitNexus runtime entrypoint must be regular and non-s

Error message

pinned GitNexus runtime entrypoint must be regular and non-symlink: {entrypoint}

What it means

After metadata reads succeed, the harness stat-checks dist/cli/index.js and rejects it if it is a symlink or anything other than a regular file (stat.S_ISREG). This blocks symlink-based TOCTOU attacks on the runtime entrypoint that could swap behavior between validation and execution.

Source

Thrown at eval/workflow_bench/runtime_mounts.py:235

            f"{SANDBOX_GITNEXUS_SHARED}/package.json",
            directory=False,
        ),
        _validated_runtime_component(
            runtime,
            "hooks/claude",
            f"{SANDBOX_GITNEXUS}/hooks/claude",
            directory=True,
        ),
    )

    entrypoint = mounts[0].source / "cli" / "index.js"
    try:
        entrypoint_mode = entrypoint.lstat().st_mode
        package = json.loads(mounts[1].source.read_text())
    except (OSError, json.JSONDecodeError) as exc:
        raise SandboxError(f"pinned GitNexus runtime metadata is invalid: {exc}") from exc
    if stat.S_ISLNK(entrypoint_mode) or not stat.S_ISREG(entrypoint_mode):
        raise SandboxError(f"pinned GitNexus runtime entrypoint must be regular and non-symlink: {entrypoint}")
    if package.get("version") != PINNED_GITNEXUS_VERSION:
        raise SandboxError(
            "pinned GitNexus runtime version drifted: "
            f"expected {PINNED_GITNEXUS_VERSION}, got {package.get('version')!r}"
        )

    linked_shared = mounts[2].source / "gitnexus-shared"
    if not linked_shared.is_symlink() or linked_shared.resolve(strict=True) != shared:
        raise SandboxError("pinned GitNexus runtime has an unexpected gitnexus-shared dependency")
    try:
        shared_package = json.loads(mounts[5].source.read_text())
    except (OSError, json.JSONDecodeError) as exc:
        raise SandboxError(f"pinned GitNexus shared runtime metadata is invalid: {exc}") from exc
    if shared_package.get("name") != "gitnexus-shared":
        raise SandboxError("pinned GitNexus shared runtime has an unexpected package identity")
    return mounts

View on GitHub (pinned to d540b00184)

Solutions

  1. Inspect the file type: `ls -l gitnexus/dist/cli/index.js` — the mode should start with `-`, not `l`.
  2. Rebuild from a clean state so tsc emits a real file: `rm -rf gitnexus/dist && cd gitnexus && npm run build`.
  3. If using pnpm/yarn workspaces, configure it to copy rather than symlink the dist artifact, or run the build under npm.
Defensive patterns

Strategy: validation

Validate before calling

import stat
from pathlib import Path

def entrypoint_is_regular(path: Path) -> bool:
    try:
        mode = path.lstat().st_mode
    except OSError:
        return False
    return stat.S_ISREG(mode) and not stat.S_ISLNK(mode)

Try / catch

try:
    mounts = trusted_gitnexus_runtime_mounts()
except SandboxError as exc:
    if "entrypoint must be regular" in str(exc):
        # rebuild dist before retrying
        ...
    raise

Prevention

When it happens

Trigger: dist/cli/index.js is a symlink (e.g., created by pnpm or yarn PnP, or manually for debugging), a broken symlink, or a non-regular file (FIFO/device).

Common situations: Switching to a package manager that hard-links/symlinks dist artifacts; manually symlinking index.js to a different CLI build; a partial clean that left a dangling symlink.

Related errors


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