{"record":{"id":"0fc9c9d74eb0938d","repo":"Graphify-Labs/graphify","slug":"cannot-parse-json-path-exc-the-file-may-be-c","errorCode":null,"errorMessage":"Cannot parse {json_path}: {exc}. The file may be corrupted — re-run 'graphify extract'.","messagePattern":"Cannot parse (.+?): (.+?)\\. The file may be corrupted — re-run 'graphify extract'\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"graphify/diagnostics.py","lineNumber":289,"sourceCode":"        \"post_build_graph_type\": graph_type,\n        \"post_build_node_count\": post_build_node_count,\n        \"post_build_edge_count\": post_build_edge_count,\n        \"post_build_error\": build_error,\n        \"producer_suppression\": scan_producer_suppression_sites(suppression_path),\n        \"examples\": examples,\n    }\n\n\ndef _read_json_file(path: str | Path) -> dict[str, Any]:\n    \"\"\"Read a JSON graph after applying Graphify's graph-load size cap.\"\"\"\n    from graphify.security import check_graph_file_size_cap\n\n    json_path = Path(path)\n    check_graph_file_size_cap(json_path)\n    try:\n        data = json.loads(json_path.read_text(encoding=\"utf-8\"))\n    except (json.JSONDecodeError, OSError) as exc:\n        raise RuntimeError(\n            f\"Cannot parse {json_path}: {exc}. \"\n            \"The file may be corrupted — re-run 'graphify extract'.\"\n        ) from exc\n    if not isinstance(data, dict):\n        raise ValueError(\"diagnostic input must be a JSON object\")\n    return data\n\n\ndef diagnose_file(\n    path: str | Path,\n    *,\n    directed: bool | None = None,\n    root: str | Path | None = None,\n    max_examples: int = 5,\n    extract_path: str | Path | None = None,\n) -> dict[str, Any]:\n    \"\"\"Diagnose a graph/extraction JSON file without mutating it.\n","sourceCodeStart":271,"sourceCodeEnd":307,"githubUrl":"https://github.com/Graphify-Labs/graphify/blob/7fe58b0b0f3873be9a21c30106b8b8527c353aa6/graphify/diagnostics.py#L271-L307","documentation":"Graph-existence preflight in the /graphify explain command of the devin fragment (tools/skillgen/fragments/core/devin.md:1268). Node-explanation traversal loads graphify-out/graph.json; this guard exits 1 with a build-first instruction when the file is missing, before the loader can fail.","triggerScenarios":"Running /graphify explain <concept> when graphify-out/graph.json is absent from the current working directory — never built, built elsewhere, deleted, or a prior build stopped before the export step.","commonSituations":"Fresh workspace without a build; cwd mismatch; graphify-out/ cleaned by CI or git clean; build previously aborted (empty extraction / shrink refusal).","solutions":["Run /graphify <path> first to produce the graph.","Check the working directory contains graphify-out/graph.json.","Repair the failing build step if a previous run never wrote graph.json.","Rebuild after cleanup."],"exampleFix":"# before\n/graphify explain middleware\n# ERROR: No graph found ...\n\n# after\n/graphify .\n/graphify explain middleware","handlingStrategy":"validation","validationCode":"from pathlib import Path\n\nif not Path('graphify-out/graph.json').is_file():\n    raise SystemExit('no graph - run /graphify <path> before explain')\nprint('ok')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Preflight before /graphify explain.","Confirm the build step completed (graph.json written) before node queries.","Query from the correct directory.","Rebuild if the graph was deleted."],"tags":["graphify","devin","preflight","missing-file","explain"],"backgroundTag":null,"analyzedSha":"7fe58b0b0f3873be9a21c30106b8b8527c353aa6","analyzedAt":"2026-08-14T19:23:21.323Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}