Graphify-Labs/graphify · error · ValueError
graph.json contains 0 nodes
Error message
graph.json contains 0 nodes
What it means
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.
Source
Thrown at graphify/callflow_html.py:1659
if not paths["graph"].exists():
raise FileNotFoundError(
f"graphify output not found: {paths['graph']}. "
"Run graphify first or pass --graph /path/to/graph.json."
)
# Load data
nodes, edges, hyperedges, meta = load_graph(paths["graph"])
labels = load_labels(paths["labels"])
lang = detect_lang(args.lang, nodes, labels)
if paths["sections"]:
sections = load_sections(paths["sections"])
else:
sections = derive_sections_from_communities(nodes, labels, lang, args.max_sections)
sections = normalize_sections(sections, lang)
report_text = load_report(paths["report"])
if not nodes:
raise ValueError("graph.json contains 0 nodes")
if len(sections) <= 1:
raise ValueError("no sections defined")
if verbose and len(nodes) >= 5000:
print("WARNING: Large graph -- Mermaid rendering may be slow. Consider --max-sections 5.", file=sys.stderr)
node_ids = {node.get("id") for node in nodes}
missing_endpoint_edges = [edge for edge in edges if edge.get("source") not in node_ids or edge.get("target") not in node_ids]
if verbose and missing_endpoint_edges:
print(f"WARNING: {len(missing_endpoint_edges)} edges reference nodes not present in graph.json.", file=sys.stderr)
meta["project_name"] = infer_project_name(str(paths["graph"]), meta)
meta["node_count"] = len(nodes)
meta["edge_count"] = len(edges)
meta["hyperedge_count"] = len(hyperedges)
if args.output:
output_path = Path(args.output).expanduser()View on GitHub (pinned to 7fe58b0b0f)
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>.
Example fix
# before /graphify path auth session # ERROR: No graph found ... # after /graphify . /graphify path auth session
Defensive patterns
Strategy: validation
Validate before calling
from pathlib import Path
if not Path('graphify-out/graph.json').is_file():
raise SystemExit('build the graph first: /graphify <path>')
print('ok - safe to run shortest-path traversal') Prevention
- 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/.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- graphify output not found: {paths['graph']}. Run graphify fi
- no sections defined
- deduplicate_entities: nodes span multiple repos {sorted(repo
- file_hash requires a file, got: {p}
- graph.json {p} is {size} bytes, exceeds {_MERGE_MAX_BYTES}-b
AI-assisted analysis of Graphify-Labs/graphify@7fe58b0b0f (2026-08-14).
Data as JSON: /api/errors/8d2eff75f3f81363.
Report an issue: GitHub.