abhigyanpatwari/GitNexus · error · SandboxError

pinned GitNexus shared runtime metadata is invalid: {exc}

Error message

pinned GitNexus shared runtime metadata is invalid: {exc}

What it means

After the shared package link is verified, the harness reads and parses gitnexus-shared/package.json. OSError (missing/unreadable) or json.JSONDecodeError (corrupt JSON) here means the shared runtime's identity cannot be confirmed.

Source

Thrown at eval/workflow_bench/runtime_mounts.py:248

        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


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

View on GitHub (pinned to d540b00184)

Solutions

  1. Restore the file from git: `git checkout HEAD -- gitnexus-shared/package.json`.
  2. Validate JSON: `node -e "JSON.parse(require('fs').readFileSync('gitnexus-shared/package.json'))"`.
  3. Check perms: `ls -l gitnexus-shared/package.json` as the harness user.
Defensive patterns

Strategy: validation

Validate before calling

import json
from pathlib import Path

def shared_package_parses(shared_root: Path) -> bool:
    try:
        json.loads((shared_root / "package.json").read_text())
        return True
    except (OSError, json.JSONDecodeError):
        return False

Try / catch

try:
    mounts = trusted_gitnexus_runtime_mounts()
except SandboxError as exc:
    if "shared runtime metadata is invalid" in str(exc):
        # restore gitnexus-shared/package.json from git
        ...
    raise

Prevention

When it happens

Trigger: gitnexus-shared/package.json is absent, has been truncated by a failed merge, or is unreadable to the harness user.

Common situations: Partial checkout that omitted the shared subproject; manual edit that broke JSON syntax; restrictive file permissions applied to the directory.

Related errors


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