abhigyanpatwari/GitNexus · error · SandboxError
sanitized graph metadata is malformed
Error message
sanitized graph metadata is malformed
What it means
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.
Source
Thrown at eval/workflow_bench/sanitized_graph.py:325
),
timeout=GRAPH_QUERY_TIMEOUT_SECONDS,
capture_stdout=True,
)
assert node_result is not None and relation_result is not None
_parse_empty_query(node_result, label="sanitized graph node proof")
_parse_empty_query(relation_result, label="sanitized graph relation proof")
def _validate_graph_metadata(root: Path, sanitized_head: str) -> None:
for name in ("gitnexus.json", "meta.json", "lbug"):
path = root / ".gitnexus" / name
metadata = path.lstat()
if stat.S_ISLNK(metadata.st_mode) or not stat.S_ISREG(metadata.st_mode):
raise SandboxError(f"sanitized graph asset must be regular and non-symlink: {path}")
try:
metadata_payload = json.loads((root / ".gitnexus" / "gitnexus.json").read_text())
except (OSError, json.JSONDecodeError) as exc:
raise SandboxError("sanitized graph metadata is malformed") from exc
if metadata_payload.get("lastCommit") != sanitized_head:
raise SandboxError("sanitized graph metadata is not bound to the parentless task commit")
if not isinstance(metadata_payload.get("pdg"), dict) or not metadata_payload["pdg"]:
raise SandboxError("sanitized graph metadata does not prove a --pdg build")
def prepare_sanitized_graph(
task: Mapping[str, Any],
*,
repo: Path,
resolved_sha: str,
parent: Path,
cache: TaskAssetCache,
claude_bin: Path | str,
bwrap_bin: Path | str,
runtime_mounts: Sequence[ReadOnlyMount],
) -> SanitizedGraphSnapshot:
"""Sanitize, index offline once, scrub, and freeze graph assets for all arms."""View on GitHub (pinned to d540b00184)
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.
Defensive patterns
Strategy: try-catch
Validate before calling
import json, os
def assert_gitnexus_json_parses(root):
p = os.path.join(root, ".gitnexus", "gitnexus.json")
try:
json.loads(open(p, "r", encoding="utf-8").read())
except (OSError, json.JSONDecodeError) as exc:
raise RuntimeError(f"gitnexus.json not parseable: {exc}") from exc Try / catch
from workflow_bench.proposer_sandbox import SandboxError
try:
prepare_sanitized_graph(...)
except SandboxError as exc:
if "metadata is malformed" in str(exc):
log.error("gitnexus.json unreadable/unparseable - confirm analyze completed and neutralization ran")
raise Prevention
- 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.
When it happens
Trigger: 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.
Common situations: Indexer crash during analyze (usually surfaced first as error 565); disk full mid-write; a leftover .gitnexus directory that neutralization should have removed.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- target-controlled {name} must not be a directory
- {label} did not return strict JSON
- skill fingerprint input must be a regular non-symlink file:
- evidence source must be a regular non-symlink file: {path}
- results directory is unavailable: {root}: {exc}
AI-assisted analysis of abhigyanpatwari/GitNexus@d540b00184 (2026-08-12).
Data as JSON: /api/errors/8b7bb0780f48fe11.
Report an issue: GitHub.