abhigyanpatwari/GitNexus · error · SandboxError

benchmark index metadata must be regular and non-symlink: {m

Error message

benchmark index metadata must be regular and non-symlink: {metadata_path}

What it means

Raised by isolated_gitnexus_registry_mount: the gitnexus index metadata file (.gitnexus/gitnexus.json, or fallback .gitnexus/meta.json) must be a regular, non-symlink file before it is read. Because the registry mount routes the sandboxed MCP away from the host repo, the metadata source is trusted input that must not be a symlink or special node — otherwise a tracked symlink could redirect or swap the index descriptor. lstat (no follow) is used and any S_ISLNK or non-S_ISREG mode is rejected.

Source

Thrown at eval/workflow_bench/runner.py:343

                raise
            primary.add_note(f"hidden oracle mountpoint cleanup also failed: {cleanup}")


def _evaluated_skill_roots(worktree: Path, arm: str) -> tuple[Path, ...]:
    """Repo-local prompt roots that must remain immutable during a session."""

    return tuple(worktree / ".claude" / "skills" / name for name in EVALUATED_ARM_SKILLS.get(arm, ()))


def isolated_gitnexus_registry_mount(worktree: Path, parent: Path) -> ReadOnlyMount:
    """Create a one-clone registry that cannot route MCP to any host repo."""

    metadata_path = worktree / ".gitnexus" / "gitnexus.json"
    if not metadata_path.exists():
        metadata_path = worktree / ".gitnexus" / "meta.json"
    mode = metadata_path.lstat().st_mode
    if stat.S_ISLNK(mode) or not stat.S_ISREG(mode):
        raise SandboxError(f"benchmark index metadata must be regular and non-symlink: {metadata_path}")
    raw = _bounded_regular_bytes(metadata_path, limit=2 * 1024 * 1024)
    try:
        metadata = json.loads(raw)
    except json.JSONDecodeError as exc:
        raise SandboxError(f"benchmark index metadata is malformed: {metadata_path}") from exc
    if not isinstance(metadata, dict):
        raise SandboxError(f"benchmark index metadata must be an object: {metadata_path}")
    indexed_at = metadata.get("indexedAt")
    last_commit = metadata.get("lastCommit")
    if not isinstance(indexed_at, str) or not indexed_at or not isinstance(last_commit, str) or not last_commit:
        raise SandboxError("benchmark index metadata is missing indexedAt or lastCommit")

    parent = parent.expanduser().absolute()
    registry = Path(tempfile.mkdtemp(prefix="wfbench-registry-", dir=parent))
    registry.chmod(0o700)
    entry: dict[str, Any] = {
        "name": "benchmark-target",
        "path": SANDBOX_WORKSPACE,

View on GitHub (pinned to d540b00184)

Solutions

  1. Inspect the metadata path: `ls -la <worktree>/.gitnexus/gitnexus.json` (and meta.json) and confirm it is a real file, not a symlink.
  2. If it is a symlink, remove it and regenerate the index so a regular file is written (`node .gitnexus/run.cjs analyze --index-only`).
  3. If .gitnexus is missing or wrong, run the indexer in the worktree before invoking the harness so a regular metadata file exists.
  4. Ensure no setup step replaces the metadata file with a symlink.

Example fix

// before — index metadata is a symlink
<worktree>/.gitnexus/gitnexus.json -> /shared/index.json
// after — regenerate as a regular file
rm <worktree>/.gitnexus/gitnexus.json
node .gitnexus/run.cjs analyze --index-only
Defensive patterns

Strategy: validation

Validate before calling

import stat
from pathlib import Path

def metadata_is_regular(path: Path) -> bool:
    mode = path.lstat().st_mode
    return not stat.S_ISLNK(mode) and stat.S_ISREG(mode)

mp = worktree / '.gitnexus' / ('gitnexus.json' if (worktree/'.gitnexus'/'gitnexus.json').exists() else 'meta.json')
assert metadata_is_regular(mp), f'{mp} must be a regular non-symlink file'

Try / catch

from .proposer_sandbox import SandboxError

try:
    mount = isolated_gitnexus_registry_mount(worktree, parent)
except SandboxError:
    # metadata is a symlink or non-regular; regenerate the index
    raise

Prevention

When it happens

Trigger: isolated_gitnexus_registry_mount(worktree, parent) computes metadata_path = worktree/.gitnexus/gitnexus.json (or meta.json); metadata_path.lstat().st_mode is a symlink or not a regular file.

Common situations: The worktree's .gitnexus index was materialized via a symlink; a tracked symlink points at an index elsewhere; a partial/corrupt index left a directory or special file at that path; the index was generated by a different tool version that wrote a non-regular artifact.

Related errors


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