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
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).
Source
Thrown at tools/skillgen/expected/graphify__skill-codex.md:416
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
- 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
Defensive patterns
Strategy: validation
Validate before calling
extraction = json.loads(Path('graphify-out/.graphify_extract.json').read_text(encoding='utf-8'))
if not (extraction.get('nodes') or extraction.get('entities')):
raise SystemExit('extraction empty — re-run Step 3 for the same INPUT_PATH')
G = build_from_json(extraction, root='INPUT_PATH', directed=IS_DIRECTED) Type guard
def extraction_has_nodes(extraction: dict) -> bool:
return bool(extraction.get('nodes') or extraction.get('entities')) Prevention
- 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
When it happens
Trigger: 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.
Common situations: Empty or fully-ignored input directory; extraction JSON left from a different path; LLM extraction failed but wrote an empty result.
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: refused to shrink graphify-out/graph.json (fewer node
AI-assisted analysis of Graphify-Labs/graphify@7fe58b0b0f (2026-08-14).
Data as JSON: /api/errors/453cb2ecc2e1a9fb.
Report an issue: GitHub.