Graphify-Labs/graphify · error · SystemExit
ERROR: Graph is empty - extraction produced no nodes.
Error message
ERROR: Graph is empty - extraction produced no nodes.
What it means
An explicit fail-fast guard (#1392) in the graphify build pipeline: immediately after build_from_json() reconstructs the graph from graphify-out/.graphify_extract.json, the script checks G.number_of_nodes() == 0 and aborts with SystemExit(1) before any write. Its purpose is to stop an empty extraction from clobbering a good graph.json, GRAPH_REPORT.md, or the analysis sidecar.
Source
Thrown at tools/skillgen/expected/graphify__skill-copilot.md:419
from graphify.build import build_from_json
from graphify.cluster import cluster, score_all
from graphify.analyze import god_nodes, surprising_connections, suggest_questions
from graphify.report import generate
from graphify.export import to_json
from pathlib import Path
extraction = json.loads(Path('graphify-out/.graphify_extract.json').read_text(encoding=\"utf-8\"))
detection = json.loads(Path('graphify-out/.graphify_detect.json').read_text(encoding=\"utf-8\"))
# root= mirrors the --update runbook (#1361): relativize source_file to the same
# base so the full build and incremental --update never drift apart on re-extract.
G = build_from_json(extraction, root='INPUT_PATH', directed=IS_DIRECTED)
# Guard BEFORE any write: an empty extraction must not clobber a good graph.json /
# GRAPH_REPORT.md / analysis sidecar. Check immediately after build (#1392).
if G.number_of_nodes() == 0:
print('ERROR: Graph is empty - extraction produced no nodes.')
print('Possible causes: all files were skipped, binary-only corpus, or extraction failed.')
raise SystemExit(1)
communities = cluster(G)
cohesion = score_all(G, communities)
tokens = {'input': extraction.get('input_tokens', 0), 'output': extraction.get('output_tokens', 0)}
gods = god_nodes(G)
surprises = surprising_connections(G, communities)
labels = {cid: 'Community ' + str(cid) for cid in communities}
# Placeholder questions - regenerated with real labels in Step 5
questions = suggest_questions(G, communities, labels)
# Export FIRST and honor the #479 shrink-guard: to_json returns False (writing
# nothing) when the new graph is smaller than the existing graph.json. Only write
# GRAPH_REPORT.md + the analysis sidecar when the graph was actually written, so
# they never describe a graph that graph.json doesn't contain (#1392).
wrote = to_json(G, communities, 'graphify-out/graph.json')
if not wrote:
print('ERROR: refused to shrink graphify-out/graph.json (existing graph has more nodes; #479).')
print('If this shrink is intentional (you deleted files), re-run a full build with --force.')
raise SystemExit(1)View on GitHub (pinned to 7fe58b0b0f)
Solutions
- Open graphify-out/.graphify_extract.json and confirm whether it contains any nodes at all — if empty, the failure is in the extraction step, not here.
- Verify INPUT_PATH points at a directory with readable text/code files and matches the path used during extraction.
- Check the extraction step's skip/ignore configuration (binary extensions, ignore globs) to see if it filtered out everything.
- Re-run the extraction step, then re-run this build step; the guard has left any previous good graph.json untouched.
Example fix
# before: guard fires, build aborts
G = build_from_json(extraction, root='INPUT_PATH', directed=IS_DIRECTED)
if G.number_of_nodes() == 0:
print('ERROR: Graph is empty - extraction produced no nodes.')
raise SystemExit(1)
# after: diagnose upstream before re-running the build
import json
from pathlib import Path
ext = json.loads(Path('graphify-out/.graphify_extract.json').read_text(encoding='utf-8'))
print('files seen by extractor:', len(ext.get('files', [])))
print('nodes extracted:', sum(len(f.get('nodes', [])) for f in ext.get('files', []))) Defensive patterns
Strategy: validation
Validate before calling
import json
from pathlib import Path
extract_path = Path('graphify-out/.graphify_extract.json')
assert extract_path.exists(), 'extraction sidecar missing - run the extraction step first'
extraction = json.loads(extract_path.read_text(encoding='utf-8'))
files = extraction.get('files', [])
assert files and any(f.get('nodes') for f in files), \
'extraction produced no nodes - check skip rules, input path, and extractor logs before building' Prevention
- Validate the extraction sidecar is non-empty before invoking the build step.
- Run extraction and build against the same input root so relativization never drops nodes.
- Log the file count and skip count from extraction so a silent all-skipped run is visible.
- Confirm the input directory contains text/code files, not only binaries or ignored types.
When it happens
Trigger: build_from_json(extraction, root='INPUT_PATH', directed=IS_DIRECTED) returning a graph with zero nodes — i.e. .graphify_extract.json contains no extractable nodes. The snippet itself lists the causes: all files were skipped, the corpus is binary-only, or the extraction step failed.
Common situations: Extraction API/LLM call failed and wrote an empty/partial extract file; input path contains only images, lockfiles, or other skipped file types; ignore/skip rules accidentally matched every file; wrong INPUT_PATH (empty dir); reading the extract with a mismatched root so every source_file relativization drops out.
Related errors
- ERROR: Graph is empty - extraction produced no nodes.
- ERROR: Graph is empty - extraction produced no nodes.
- ERROR: Graph is empty - extraction produced no nodes.
- ERROR: Graph is empty - extraction produced no nodes.
- ERROR: Graph is empty - extraction produced no nodes.
AI-assisted analysis of Graphify-Labs/graphify@7fe58b0b0f (2026-08-14).
Data as JSON: /api/errors/a21f34c8968730cb.
Report an issue: GitHub.