{"record":{"id":"453cb2ecc2e1a9fb","repo":"Graphify-Labs/graphify","slug":"error-graph-is-empty-extraction-produced-no-nod-453cb2","errorCode":null,"errorMessage":"ERROR: Graph is empty - extraction produced no nodes.","messagePattern":"ERROR: Graph is empty - extraction produced no nodes\\.","errorType":"console","errorClass":"SystemExit","httpStatus":null,"severity":"error","filePath":"tools/skillgen/expected/graphify__skill-codex.md","lineNumber":416,"sourceCode":"from graphify.build import build_from_json\nfrom graphify.cluster import cluster, score_all\nfrom graphify.analyze import god_nodes, surprising_connections, suggest_questions\nfrom graphify.report import generate\nfrom graphify.export import to_json\nfrom pathlib import Path\n\nextraction = json.loads(Path('graphify-out/.graphify_extract.json').read_text(encoding=\\\"utf-8\\\"))\ndetection  = json.loads(Path('graphify-out/.graphify_detect.json').read_text(encoding=\\\"utf-8\\\"))\n\n# root= mirrors the --update runbook (#1361): relativize source_file to the same\n# base so the full build and incremental --update never drift apart on re-extract.\nG = build_from_json(extraction, root='INPUT_PATH', directed=IS_DIRECTED)\n# Guard BEFORE any write: an empty extraction must not clobber a good graph.json /\n# GRAPH_REPORT.md / analysis sidecar. Check immediately after build (#1392).\nif G.number_of_nodes() == 0:\n    print('ERROR: Graph is empty - extraction produced no nodes.')\n    print('Possible causes: all files were skipped, binary-only corpus, or extraction failed.')\n    raise SystemExit(1)\ncommunities = cluster(G)\ncohesion = score_all(G, communities)\ntokens = {'input': extraction.get('input_tokens', 0), 'output': extraction.get('output_tokens', 0)}\ngods = god_nodes(G)\nsurprises = surprising_connections(G, communities)\nlabels = {cid: 'Community ' + str(cid) for cid in communities}\n# Placeholder questions - regenerated with real labels in Step 5\nquestions = suggest_questions(G, communities, labels)\n\n# Export FIRST and honor the #479 shrink-guard: to_json returns False (writing\n# nothing) when the new graph is smaller than the existing graph.json. Only write\n# GRAPH_REPORT.md + the analysis sidecar when the graph was actually written, so\n# they never describe a graph that graph.json doesn't contain (#1392).\nwrote = to_json(G, communities, 'graphify-out/graph.json')\nif not wrote:\n    print('ERROR: refused to shrink graphify-out/graph.json (existing graph has more nodes; #479).')\n    print('If this shrink is intentional (you deleted files), re-run a full build with --force.')\n    raise SystemExit(1)","sourceCodeStart":398,"sourceCodeEnd":434,"githubUrl":"https://github.com/Graphify-Labs/graphify/blob/7fe58b0b0f3873be9a21c30106b8b8527c353aa6/tools/skillgen/expected/graphify__skill-codex.md#L398-L434","documentation":"The empty-graph guard in the generated Codex host render of the graphify skill (tools/skillgen/expected/graphify__skill-codex.md), matching skill.md Step 4: it checks G.number_of_nodes() immediately after build_from_json(extraction, root='INPUT_PATH', directed=IS_DIRECTED) and exits with this error before any write, so an empty extraction cannot clobber a good graph.json / GRAPH_REPORT.md / analysis sidecar (#1392).","triggerScenarios":"Running the Codex skill's Step 4 when graphify-out/.graphify_extract.json produces zero nodes: all files skipped, binary-only corpus, or failed extraction.","commonSituations":"Empty or fully-ignored input directory; extraction JSON left from a different path; LLM extraction failed but wrote an empty result.","solutions":["Re-run the extraction step for the same INPUT_PATH; confirm .graphify_extract.json has nodes before building","Verify the corpus contains extractable text/code and .graphifyignore is not excluding everything","Delete the empty extraction JSON and re-extract from scratch"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"extraction = json.loads(Path('graphify-out/.graphify_extract.json').read_text(encoding='utf-8'))\nif not (extraction.get('nodes') or extraction.get('entities')):\n    raise SystemExit('extraction empty — re-run Step 3 for the same INPUT_PATH')\nG = build_from_json(extraction, root='INPUT_PATH', directed=IS_DIRECTED)","typeGuard":"def extraction_has_nodes(extraction: dict) -> bool:\n    return bool(extraction.get('nodes') or extraction.get('entities'))","tryCatchPattern":null,"preventionTips":["Validate the extraction payload is non-empty before the Codex skill's build step","Ensure the target path has extractable sources not excluded by .graphifyignore","Re-run extraction whenever the previous run may have failed partway"],"tags":["graphify","generated-skill","guard","empty-state","codex"],"backgroundTag":null,"analyzedSha":"7fe58b0b0f3873be9a21c30106b8b8527c353aa6","analyzedAt":"2026-08-14T19:23:21.323Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}