{"record":{"id":"8b7bb0780f48fe11","repo":"abhigyanpatwari/GitNexus","slug":"sanitized-graph-metadata-is-malformed","errorCode":null,"errorMessage":"sanitized graph metadata is malformed","messagePattern":"sanitized graph metadata is malformed","errorType":"exception","errorClass":"SandboxError","httpStatus":null,"severity":"error","filePath":"eval/workflow_bench/sanitized_graph.py","lineNumber":325,"sourceCode":"        ),\n        timeout=GRAPH_QUERY_TIMEOUT_SECONDS,\n        capture_stdout=True,\n    )\n    assert node_result is not None and relation_result is not None\n    _parse_empty_query(node_result, label=\"sanitized graph node proof\")\n    _parse_empty_query(relation_result, label=\"sanitized graph relation proof\")\n\n\ndef _validate_graph_metadata(root: Path, sanitized_head: str) -> None:\n    for name in (\"gitnexus.json\", \"meta.json\", \"lbug\"):\n        path = root / \".gitnexus\" / name\n        metadata = path.lstat()\n        if stat.S_ISLNK(metadata.st_mode) or not stat.S_ISREG(metadata.st_mode):\n            raise SandboxError(f\"sanitized graph asset must be regular and non-symlink: {path}\")\n    try:\n        metadata_payload = json.loads((root / \".gitnexus\" / \"gitnexus.json\").read_text())\n    except (OSError, json.JSONDecodeError) as exc:\n        raise SandboxError(\"sanitized graph metadata is malformed\") from exc\n    if metadata_payload.get(\"lastCommit\") != sanitized_head:\n        raise SandboxError(\"sanitized graph metadata is not bound to the parentless task commit\")\n    if not isinstance(metadata_payload.get(\"pdg\"), dict) or not metadata_payload[\"pdg\"]:\n        raise SandboxError(\"sanitized graph metadata does not prove a --pdg build\")\n\n\ndef prepare_sanitized_graph(\n    task: Mapping[str, Any],\n    *,\n    repo: Path,\n    resolved_sha: str,\n    parent: Path,\n    cache: TaskAssetCache,\n    claude_bin: Path | str,\n    bwrap_bin: Path | str,\n    runtime_mounts: Sequence[ReadOnlyMount],\n) -> SanitizedGraphSnapshot:\n    \"\"\"Sanitize, index offline once, scrub, and freeze graph assets for all arms.\"\"\"","sourceCodeStart":307,"sourceCodeEnd":343,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/d540b00184d71a896261ee02670da9a92d59d8f7/eval/workflow_bench/sanitized_graph.py#L307-L343","documentation":"Reading or JSON-parsing .gitnexus/gitnexus.json raised OSError or json.JSONDecodeError. The metadata file the indexer should have written is missing, unreadable, or not valid JSON.","triggerScenarios":"The analyze run failed to write gitnexus.json (crashed mid-write), wrote a partial file, or a stale/foreign non-JSON file was left in place and survived _neutralize_target_index_inputs.","commonSituations":"Indexer crash during analyze (usually surfaced first as error 565); disk full mid-write; a leftover .gitnexus directory that neutralization should have removed.","solutions":["Open .gitnexus/gitnexus.json in the seed and inspect the parse error or partial content.","Ensure _neutralize_target_index_inputs removed the prior .gitnexus (shutil.rmtree) before analyze.","Confirm the analyze command actually completed (error 565) and the indexer version writes this metadata file.","Rebuild the sanitized graph from a clean seed."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"import json, os\n\ndef assert_gitnexus_json_parses(root):\n    p = os.path.join(root, \".gitnexus\", \"gitnexus.json\")\n    try:\n        json.loads(open(p, \"r\", encoding=\"utf-8\").read())\n    except (OSError, json.JSONDecodeError) as exc:\n        raise RuntimeError(f\"gitnexus.json not parseable: {exc}\") from exc","typeGuard":null,"tryCatchPattern":"from workflow_bench.proposer_sandbox import SandboxError\n\ntry:\n    prepare_sanitized_graph(...)\nexcept SandboxError as exc:\n    if \"metadata is malformed\" in str(exc):\n        log.error(\"gitnexus.json unreadable/unparseable - confirm analyze completed and neutralization ran\")\n    raise","preventionTips":["Confirm error 565 (analyze success) precedes this metadata read.","Ensure _neutralize_target_index_inputs removed the prior .gitnexus before analyze.","Free up disk space so the indexer can write metadata atomically."],"tags":["gitnexus","json","filesystem","workflow-bench"],"backgroundTag":null,"analyzedSha":"d540b00184d71a896261ee02670da9a92d59d8f7","analyzedAt":"2026-08-12T19:50:25.132Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}