{"record":{"id":"1ad9352edaf3652f","repo":"abhigyanpatwari/GitNexus","slug":"label-did-not-return-strict-json","errorCode":null,"errorMessage":"{label} did not return strict JSON","messagePattern":"(.+?) did not return strict JSON","errorType":"exception","errorClass":"SandboxError","httpStatus":null,"severity":"error","filePath":"eval/workflow_bench/sanitized_graph.py","lineNumber":281,"sourceCode":"    if not result.ok:\n        raise ManagedProcessError(command, result)\n    if not capture_stdout:\n        return None\n    if result.stdout_capture is None or result.stdout_capture_overflow:\n        raise SandboxError(\"bounded graph-query output was unavailable\")\n    return result.stdout_capture\n\n\ndef _marker_predicate(variable: str) -> str:\n    literals = (\"'\" + marker.replace(\"\\\\\", \"\\\\\\\\\").replace(\"'\", \"\\\\'\") + \"'\" for marker in GRAPH_MARKERS)\n    return \" OR \".join(f\"CAST({variable} AS STRING) CONTAINS {literal}\" for literal in literals)\n\n\ndef _parse_empty_query(raw: bytes, *, label: str) -> None:\n    try:\n        payload = json.loads(raw.decode(\"utf-8\", errors=\"strict\"))\n    except (UnicodeError, json.JSONDecodeError) as exc:\n        raise SandboxError(f\"{label} did not return strict JSON\") from exc\n    if payload == []:\n        return\n    if isinstance(payload, dict) and payload.get(\"row_count\") == 0:\n        return\n    raise SandboxError(f\"{label} found recoverable benchmark harness references\")\n\n\ndef _scrub_and_verify_graph(prefix: Sequence[str]) -> None:\n    node_predicate = _marker_predicate(\"n\")\n    relation_predicate = _marker_predicate(\"r\")\n    node_result = _run_graph_cli(\n        prefix,\n        (\"cypher\", f\"MATCH (n) WHERE {node_predicate} RETURN n LIMIT 1\", \"-r\", \"benchmark-target\", \"--limit\", \"1\"),\n        timeout=GRAPH_QUERY_TIMEOUT_SECONDS,\n        capture_stdout=True,\n    )\n    relation_result = _run_graph_cli(\n        prefix,","sourceCodeStart":263,"sourceCodeEnd":299,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/d540b00184d71a896261ee02670da9a92d59d8f7/eval/workflow_bench/sanitized_graph.py#L263-L299","documentation":"In _parse_empty_query, decoding the captured stdout as strict UTF-8 or json.loads-parsing it failed. The cypher marker-proof result must be strict JSON (either [] or an object with row_count) for the harness to trust the empty-set verdict.","triggerScenarios":"The 'gitnexus cypher ... -r benchmark-target' query returned non-JSON (human-readable text, an error banner, partial output) or non-UTF-8 bytes despite exiting 0.","commonSituations":"A CLI version change altering cypher output formatting; an error message printed to stdout instead of stderr with exit 0; locale/encoding issues inside the sandbox producing non-UTF-8 text.","solutions":["Dump the raw captured bytes to inspect what the CLI actually emitted.","Confirm the gitnexus CLI version produces JSON for the cypher subcommand with the given flags.","Set LANG/LC_ALL appropriately in _graph_environment() so the CLI emits UTF-8.","Ensure the cypher subcommand writes JSON to stdout and diagnostics to stderr."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"import json\n\ndef assert_cypher_json(raw: bytes):\n    try:\n        json.loads(raw.decode(\"utf-8\", errors=\"strict\"))\n    except (UnicodeError, json.JSONDecodeError) as exc:\n        raise RuntimeError(f\"cypher output not strict JSON: {exc}; head={raw[:200]!r}\") from exc","typeGuard":null,"tryCatchPattern":"from workflow_bench.proposer_sandbox import SandboxError\n\ntry:\n    prepare_sanitized_graph(...)\nexcept SandboxError as exc:\n    if \"did not return strict JSON\" in str(exc):\n        log.error(\"cypher proof emitted non-JSON - check CLI version and locale in _graph_environment()\")\n    raise","preventionTips":["Pin the gitnexus CLI version whose cypher subcommand emits JSON to stdout.","Set LANG/LC_ALL to a UTF-8 locale in _graph_environment().","Regression-test cypher JSON output when bumping the indexer."],"tags":["gitnexus","json","workflow-bench","sandbox"],"backgroundTag":null,"analyzedSha":"d540b00184d71a896261ee02670da9a92d59d8f7","analyzedAt":"2026-08-12T19:50:25.132Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}