Graphify-Labs/graphify · error · ValueError

no sections defined

Error message

no sections defined

What it means

Graph-existence preflight in the /graphify explain command of the aider fragment (tools/skillgen/fragments/core/aider.md:1135). Explain loads a single node and everything connected to it from graphify-out/graph.json; the guard exits 1 with a clear message when that file is missing rather than letting the subsequent json.loads fail.

Source

Thrown at graphify/callflow_html.py:1661

            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()
        if not output_path.is_absolute():
            output_path = paths["base"] / output_path

View on GitHub (pinned to 7fe58b0b0f)

Solutions

  1. Run /graphify <path> to build, then retry /graphify explain.
  2. Confirm cwd contains graphify-out/graph.json.
  3. Fix any prior build failure that prevented graph.json from being written.
  4. Rebuild after cleanup operations that removed graphify-out/.

Example fix

# before
/graphify explain Guardian
# ERROR: No graph found ...

# after
/graphify .
/graphify explain Guardian
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 explain traversal')

Prevention

When it happens

Trigger: Running /graphify explain <node> when graphify-out/graph.json is absent from the current working directory — never built, wrong cwd, deleted, or a prior build terminated before export.

Common situations: Asking to explain a node before building the graph; agent in a subdir; CI/cleanup removed graphify-out/; the build step stopped at the empty-extraction or shrink-guard check.

Related errors


AI-assisted analysis of Graphify-Labs/graphify@7fe58b0b0f (2026-08-14). Data as JSON: /api/errors/ad590ab26c6de45d. Report an issue: GitHub.