{"record":{"id":"8d2eff75f3f81363","repo":"Graphify-Labs/graphify","slug":"graph-json-contains-0-nodes","errorCode":null,"errorMessage":"graph.json contains 0 nodes","messagePattern":"graph\\.json contains 0 nodes","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"graphify/callflow_html.py","lineNumber":1659,"sourceCode":"    if not paths[\"graph\"].exists():\n        raise FileNotFoundError(\n            f\"graphify output not found: {paths['graph']}. \"\n            \"Run graphify first or pass --graph /path/to/graph.json.\"\n        )\n\n    # Load data\n    nodes, edges, hyperedges, meta = load_graph(paths[\"graph\"])\n    labels = load_labels(paths[\"labels\"])\n    lang = detect_lang(args.lang, nodes, labels)\n    if paths[\"sections\"]:\n        sections = load_sections(paths[\"sections\"])\n    else:\n        sections = derive_sections_from_communities(nodes, labels, lang, args.max_sections)\n    sections = normalize_sections(sections, lang)\n    report_text = load_report(paths[\"report\"])\n\n    if not nodes:\n        raise ValueError(\"graph.json contains 0 nodes\")\n    if len(sections) <= 1:\n        raise ValueError(\"no sections defined\")\n\n    if verbose and len(nodes) >= 5000:\n        print(\"WARNING: Large graph -- Mermaid rendering may be slow. Consider --max-sections 5.\", file=sys.stderr)\n\n    node_ids = {node.get(\"id\") for node in nodes}\n    missing_endpoint_edges = [edge for edge in edges if edge.get(\"source\") not in node_ids or edge.get(\"target\") not in node_ids]\n    if verbose and missing_endpoint_edges:\n        print(f\"WARNING: {len(missing_endpoint_edges)} edges reference nodes not present in graph.json.\", file=sys.stderr)\n\n    meta[\"project_name\"] = infer_project_name(str(paths[\"graph\"]), meta)\n    meta[\"node_count\"] = len(nodes)\n    meta[\"edge_count\"] = len(edges)\n    meta[\"hyperedge_count\"] = len(hyperedges)\n\n    if args.output:\n        output_path = Path(args.output).expanduser()","sourceCodeStart":1641,"sourceCodeEnd":1677,"githubUrl":"https://github.com/Graphify-Labs/graphify/blob/7fe58b0b0f3873be9a21c30106b8b8527c353aa6/graphify/callflow_html.py#L1641-L1677","documentation":"Graph-existence preflight in the /graphify path command of the aider fragment (tools/skillgen/fragments/core/aider.md:1062). Shortest-path queries load graphify-out/graph.json via networkx json_graph; the guard raises SystemExit(1) up front if that file is missing, instead of letting the loader throw a confusing FileNotFoundError.","triggerScenarios":"Invoking /graphify path <conceptA> <conceptB> when graphify-out/graph.json does not exist in the current working directory — graph never built, built under a different root, or deleted.","commonSituations":"Querying before any build; wrong cwd (relative path miss); graphify-out removed by git clean/CI; earlier build exited at the empty-graph or shrink guard so graph.json was never written.","solutions":["Build the graph first with /graphify <path>, then re-run the path query.","cd to the directory that contains graphify-out/ (the preflight and loader both use relative paths).","If the build previously failed, resolve that failure (extraction/shrink) before querying.","Rebuild the graph if it was cleaned: /graphify <path>."],"exampleFix":"# before\n/graphify path auth session\n# ERROR: No graph found ...\n\n# after\n/graphify .\n/graphify path auth session","handlingStrategy":"validation","validationCode":"from pathlib import Path\n\nif not Path('graphify-out/graph.json').is_file():\n    raise SystemExit('build the graph first: /graphify <path>')\nprint('ok - safe to run shortest-path traversal')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always execute the preflight check before /graphify path.","Build the graph before path queries in fresh workspaces.","Ensure the agent's cwd matches the graph location.","Rebuild after cleanup removes graphify-out/."],"tags":["graphify","aider","preflight","missing-file","shortest-path"],"backgroundTag":null,"analyzedSha":"7fe58b0b0f3873be9a21c30106b8b8527c353aa6","analyzedAt":"2026-08-14T19:23:21.323Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}