{"record":{"id":"51842b346c408f72","repo":"abhigyanpatwari/GitNexus","slug":"benchmark-index-metadata-must-be-an-object-metad","errorCode":null,"errorMessage":"benchmark index metadata must be an object: {metadata_path}","messagePattern":"benchmark index metadata must be an object: (.+?)","errorType":"exception","errorClass":"SandboxError","httpStatus":null,"severity":"error","filePath":"eval/workflow_bench/runner.py","lineNumber":350,"sourceCode":"    return tuple(worktree / \".claude\" / \"skills\" / name for name in EVALUATED_ARM_SKILLS.get(arm, ()))\n\n\ndef isolated_gitnexus_registry_mount(worktree: Path, parent: Path) -> ReadOnlyMount:\n    \"\"\"Create a one-clone registry that cannot route MCP to any host repo.\"\"\"\n\n    metadata_path = worktree / \".gitnexus\" / \"gitnexus.json\"\n    if not metadata_path.exists():\n        metadata_path = worktree / \".gitnexus\" / \"meta.json\"\n    mode = metadata_path.lstat().st_mode\n    if stat.S_ISLNK(mode) or not stat.S_ISREG(mode):\n        raise SandboxError(f\"benchmark index metadata must be regular and non-symlink: {metadata_path}\")\n    raw = _bounded_regular_bytes(metadata_path, limit=2 * 1024 * 1024)\n    try:\n        metadata = json.loads(raw)\n    except json.JSONDecodeError as exc:\n        raise SandboxError(f\"benchmark index metadata is malformed: {metadata_path}\") from exc\n    if not isinstance(metadata, dict):\n        raise SandboxError(f\"benchmark index metadata must be an object: {metadata_path}\")\n    indexed_at = metadata.get(\"indexedAt\")\n    last_commit = metadata.get(\"lastCommit\")\n    if not isinstance(indexed_at, str) or not indexed_at or not isinstance(last_commit, str) or not last_commit:\n        raise SandboxError(\"benchmark index metadata is missing indexedAt or lastCommit\")\n\n    parent = parent.expanduser().absolute()\n    registry = Path(tempfile.mkdtemp(prefix=\"wfbench-registry-\", dir=parent))\n    registry.chmod(0o700)\n    entry: dict[str, Any] = {\n        \"name\": \"benchmark-target\",\n        \"path\": SANDBOX_WORKSPACE,\n        \"storagePath\": f\"{SANDBOX_WORKSPACE}/.gitnexus\",\n        \"indexedAt\": indexed_at,\n        \"lastCommit\": last_commit,\n    }\n    for field in (\"remoteUrl\", \"stats\", \"branch\"):\n        if field in metadata:\n            entry[field] = metadata[field]","sourceCodeStart":332,"sourceCodeEnd":368,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/d540b00184d71a896261ee02670da9a92d59d8f7/eval/workflow_bench/runner.py#L332-L368","documentation":"Raised by isolated_gitnexus_registry_mount after JSON parsing succeeds but the top-level value is not a JSON object (dict). The registry entry is built by reading fields like indexedAt and lastCommit off the metadata, so a non-object (array, string, number, null, bool) is unusable and rejected. This is a structural validation of the index descriptor.","triggerScenarios":"json.loads(raw) returned a list, string, number, bool, or None (not a dict), so `isinstance(metadata, dict)` is False.","commonSituations":"The indexer (or a hand edit) wrote a top-level JSON array or a bare value; an older/newer indexer format changed the top-level shape; the wrong file was placed at .gitnexus/gitnexus.json (e.g. a registry array meant for registry.json).","solutions":["Inspect the top-level JSON type: `python3 -c \"import json; print(type(json.load(open('<worktree>/.gitnexus/gitnexus.json'))))\"` — it must be dict.","If it is an array or scalar, regenerate the index with the matching indexer version so an object is written.","Make sure gitnexus.json/meta.json is the index descriptor, not the registry.json list the harness itself writes.","Re-run `node .gitnexus/run.cjs analyze --index-only` to produce a well-formed object descriptor."],"exampleFix":"// before — top-level is an array (wrong file/format)\n[ {\"indexedAt\": \"...\", \"lastCommit\": \"...\"} ]\n// after — regenerate an object descriptor\nrm <worktree>/.gitnexus/gitnexus.json\nnode .gitnexus/run.cjs analyze --index-only","handlingStrategy":"type-guard","validationCode":"import json\nfrom pathlib import Path\n\nd = json.loads((worktree / '.gitnexus' / 'gitnexus.json').read_bytes())\nassert isinstance(d, dict), f'top-level metadata must be an object, got {type(d).__name__}'","typeGuard":"import json\nfrom typing import Any\n\ndef is_metadata_object(raw: bytes) -> bool:\n    try:\n        v = json.loads(raw)\n    except json.JSONDecodeError:\n        return False\n    return isinstance(v, dict)","tryCatchPattern":"from .proposer_sandbox import SandboxError\n\ntry:\n    mount = isolated_gitnexus_registry_mount(worktree, parent)\nexcept SandboxError as exc:\n    if 'must be an object' in str(exc):\n        # regenerate the index so a proper object descriptor is written\n        raise\n    raise","preventionTips":["Use a current indexer version that emits an object descriptor.","Do not place a registry.json (array) at the gitnexus.json path.","Validate the top-level JSON type after indexing."],"tags":["sandbox","registry","gitnexus","json","validation"],"backgroundTag":null,"analyzedSha":"d540b00184d71a896261ee02670da9a92d59d8f7","analyzedAt":"2026-08-12T19:50:25.132Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}