{"record":{"id":"fd4a6464023fa253","repo":"Graphify-Labs/graphify","slug":"error-graph-is-empty-extraction-produced-no-nod-fd4a64","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-devin.md","lineNumber":477,"sourceCode":"$(cat graphify-out/.graphify_python) -c \"\nimport sys, json\nfrom 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())\ndetection  = json.loads(Path('graphify-out/.graphify_detect.json').read_text())\n\nG = build_from_json(extraction, 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# Persist the graph first and only write the report/analysis if it actually\n# persisted - to_json refuses to shrink an existing graph.json (#479), and a\n# report describing a graph we did not write would be a lie (#1392).\nwrote = to_json(G, communities, 'graphify-out/graph.json')\nif not wrote:\n    print('ERROR: refused to shrink graphify-out/graph.json (fewer nodes than the existing graph). Run a full rebuild to be safe.')\n    raise SystemExit(1)\nreport = generate(G, communities, cohesion, labels, gods, surprises, detection, tokens, 'INPUT_PATH', suggested_questions=questions)\nPath('graphify-out/GRAPH_REPORT.md').write_text(report)","sourceCodeStart":459,"sourceCodeEnd":495,"githubUrl":"https://github.com/Graphify-Labs/graphify/blob/7fe58b0b0f3873be9a21c30106b8b8527c353aa6/tools/skillgen/expected/graphify__skill-devin.md#L459-L495","documentation":"A fail-fast guard (#1392) in the graphify build script: right after G = build_from_json(extraction, directed=IS_DIRECTED), the script aborts with SystemExit(1) if the graph has zero nodes. It exists so a botched or empty extraction can never clobber an existing good graph.json / GRAPH_REPORT.md / analysis sidecar. Note this devin variant calls build_from_json without the root= parameter used by the other skill variants.","triggerScenarios":"build_from_json() producing an empty graph from graphify-out/.graphify_extract.json — all files skipped by the extractor, a binary-only corpus, or a failed extraction pass that wrote no nodes.","commonSituations":"Extraction API failure leaving an empty extract file; input directory containing only skipped file types; over-aggressive ignore rules; wrong working directory so the extract file read is empty or from another project.","solutions":["Inspect graphify-out/.graphify_extract.json — if it has no nodes, fix and re-run the extraction step, not this one.","Verify the input path actually contains extractable text/code files.","Check extractor skip rules (binary extensions, ignore globs) for over-matching.","Re-run extraction then this build step; previous outputs remain intact thanks to the guard."],"exampleFix":"# before: empty extraction aborts before any write\nG = build_from_json(extraction, directed=IS_DIRECTED)\nif G.number_of_nodes() == 0:\n    print('ERROR: Graph is empty - extraction produced no nodes.')\n    raise SystemExit(1)\n\n# after: validate the extract payload first\nassert extraction.get('files'), 'extract has no files - re-run extraction step'\nG = build_from_json(extraction, directed=IS_DIRECTED)\nassert G.number_of_nodes() > 0, 'extract produced 0 nodes - check skip rules / input path'","handlingStrategy":"validation","validationCode":"import json\nfrom pathlib import Path\n\nextraction = json.loads(Path('graphify-out/.graphify_extract.json').read_text())\nfiles = extraction.get('files', [])\nif not files or not any(f.get('nodes') for f in files):\n    raise SystemExit('extraction empty - re-run extraction before building')\nG = build_from_json(extraction, directed=IS_DIRECTED)\nassert G.number_of_nodes() > 0, 'build produced 0 nodes'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Assert the extract sidecar contains nodes before building.","Keep extraction and build steps in the same working directory.","Watch extractor logs for 'all files skipped' conditions.","Note this devin variant omits root=; if source_file paths are relative, pass the matching root."],"tags":["graphify","extraction","empty-graph","fail-fast","build"],"backgroundTag":null,"analyzedSha":"7fe58b0b0f3873be9a21c30106b8b8527c353aa6","analyzedAt":"2026-08-14T19:23:21.323Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}