abhigyanpatwari/GitNexus · error · SandboxError

benchmark index metadata is missing indexedAt or lastCommit

Error message

benchmark index metadata is missing indexedAt or lastCommit

What it means

Raised by isolated_gitnexus_registry_mount when the metadata object is missing the indexedAt or lastCommit fields, or either is not a non-empty string. These two fields are copied verbatim into the isolated registry entry to pin the index provenance; without both, the sandboxed MCP cannot trust which index/commit it is routing to, so staging aborts.

Source

Thrown at eval/workflow_bench/runner.py:354

    """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,
        "storagePath": f"{SANDBOX_WORKSPACE}/.gitnexus",
        "indexedAt": indexed_at,
        "lastCommit": last_commit,
    }
    for field in ("remoteUrl", "stats", "branch"):
        if field in metadata:
            entry[field] = metadata[field]
    registry_file = registry / "registry.json"
    descriptor = os.open(
        registry_file,
        os.O_WRONLY | os.O_CREAT | os.O_EXCL | getattr(os, "O_NOFOLLOW", 0),

View on GitHub (pinned to d540b00184)

Solutions

  1. Print the keys present: `python3 -c "import json; d=json.load(open('<worktree>/.gitnexus/gitnexus.json')); print(d.get('indexedAt'), d.get('lastCommit'))"`.
  2. If missing or empty, regenerate the index with a current indexer so both provenance strings are written.
  3. If manually authoring the descriptor, include non-empty string values for both indexedAt and lastCommit.
  4. Upgrade/downgrade mismatch: align the indexer version with what the harness expects.

Example fix

// before — descriptor lacks provenance fields
{ "stats": {"symbols": 100} }
// after — regenerate so indexedAt + lastCommit are present
rm <worktree>/.gitnexus/gitnexus.json
node .gitnexus/run.cjs analyze --index-only
// resulting object includes: { "indexedAt": "2026-...", "lastCommit": "abc123..." }
Defensive patterns

Strategy: validation

Validate before calling

import json
from pathlib import Path

d = json.loads((worktree / '.gitnexus' / 'gitnexus.json').read_bytes())
indexed_at, last_commit = d.get('indexedAt'), d.get('lastCommit')
assert isinstance(indexed_at, str) and indexed_at, 'missing/empty indexedAt'
assert isinstance(last_commit, str) and last_commit, 'missing/empty lastCommit'

Type guard

def has_provenance(d: object) -> bool:
    return (
        isinstance(d, dict)
        and isinstance(d.get('indexedAt'), str) and bool(d['indexedAt'])
        and isinstance(d.get('lastCommit'), str) and bool(d['lastCommit'])
    )

Try / catch

from .proposer_sandbox import SandboxError

try:
    mount = isolated_gitnexus_registry_mount(worktree, parent)
except SandboxError as exc:
    if 'missing indexedAt or lastCommit' in str(exc):
        # regenerate the index with a current indexer so provenance is written
        raise
    raise

Prevention

When it happens

Trigger: metadata is a dict but metadata.get('indexedAt') or metadata.get('lastCommit') is missing, None, empty, or non-string — e.g. the indexer wrote the object without these provenance keys.

Common situations: An older indexer version that did not emit indexedAt/lastCommit; a manually constructed descriptor missing the keys; a field rename in a newer index format; values written as numbers/null instead of strings.

Related errors


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