abhigyanpatwari/GitNexus · error · SandboxError

pinned GitNexus shared runtime has an unexpected package ide

Error message

pinned GitNexus shared runtime has an unexpected package identity

What it means

Even when gitnexus-shared/package.json parses, the harness asserts its `name` field equals exactly "gitnexus-shared". A different name implies the symlink points to the wrong package, which would silently swap dependencies under the benchmark.

Source

Thrown at eval/workflow_bench/runtime_mounts.py:250

    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


def validate_ce_plugin_inputs(
    arms: Sequence[str],
    plugin_dir: Path | None,
    plugin_version: str | None,
) -> CePluginConfig | None:
    """Require an explicit directory and exact version iff a CE arm is selected."""

    has_ce_arm = any(arm in CE_ARMS for arm in arms)
    supplied = plugin_dir is not None or plugin_version is not None
    if not has_ce_arm:
        if supplied:
            raise ValueError("--ce-plugin-dir and --ce-plugin-version require at least one ce_* arm")
        return None
    if plugin_dir is None or plugin_version is None:
        raise ValueError("ce_* arms require both --ce-plugin-dir and --ce-plugin-version")

View on GitHub (pinned to d540b00184)

Solutions

  1. Confirm the resolved target identity: `node -p "require('./gitnexus-shared/package.json').name"` must print `gitnexus-shared`.
  2. Re-point the link to the real shared package and reinstall from the workspace root.

Example fix

// before
// gitnexus-shared/package.json
{ "name": "gitnexus-shared-dev" }
// after
{ "name": "gitnexus-shared" }
Defensive patterns

Strategy: validation

Validate before calling

import json
from pathlib import Path

def shared_package_identity_ok(shared_root: Path) -> bool:
    try:
        return json.loads((shared_root / "package.json").read_text()).get("name") == "gitnexus-shared"
    except (OSError, json.JSONDecodeError):
        return False

Try / catch

try:
    mounts = trusted_gitnexus_runtime_mounts()
except SandboxError as exc:
    if "unexpected package identity" in str(exc):
        # relink node_modules to the real shared package
        ...
    raise

Prevention

When it happens

Trigger: gitnexus/node_modules/gitnexus-shared resolves to a directory whose package.json `name` is anything other than "gitnexus-shared" (e.g., a fork, a renamed experiment, or a placeholder).

Common situations: Operator relinked node_modules/gitnexus-shared to a sibling experiment; the shared package was temporarily renamed during a refactor and not reverted; vendored copy with a different name.

Related errors


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