Graphify-Labs/graphify · warning · ValueError
Graph has {G.number_of_nodes()} nodes - too large for HTML v
Error message
Graph has {G.number_of_nodes()} nodes - too large for HTML viz (limit: {limit}). Use --no-viz, raise GRAPHIFY_VIZ_NODE_LIMIT, or reduce input size. What it means
Raised by the HTML exporter when the graph exceeds the visualization node limit (env var GRAPHIFY_VIZ_NODE_LIMIT). Rendering hundreds of thousands of DOM nodes freezes browsers, so graphify hard-caps the interactive view. Note the aggregation path above it: if a smaller aggregated community view was possible it returns early; this error means even that escape hatch wasn't taken (e.g. --no-viz off, aggregation disabled or also too large), so it raises instead of silently producing a broken page.
Source
Thrown at graphify/exporters/html.py:468
s = str(c)
if s in seen:
continue
seen.add(s)
comm_ids.append(s)
if len(comm_ids) < 2:
continue
remapped.append({
"id": he.get("id", ""),
"label": he.get("label") or he.get("relation", "").replace("_", " "),
"nodes": comm_ids,
})
meta.graph["hyperedges"] = remapped
to_html(meta, meta_communities, output_path,
community_labels=community_labels, member_counts=mc)
print(f"graph.html written (aggregated: {meta.number_of_nodes()} community nodes, {meta.number_of_edges()} cross-community edges)")
print("Tip: run with --obsidian for full node-level detail.")
return
raise ValueError(
f"Graph has {G.number_of_nodes()} nodes - too large for HTML viz "
f"(limit: {limit}). Use --no-viz, raise GRAPHIFY_VIZ_NODE_LIMIT, "
f"or reduce input size."
)
node_community = _node_community_map(communities)
degree = dict(G.degree())
max_deg = max(degree.values(), default=1) or 1
max_mc = (max(member_counts.values(), default=1) or 1) if member_counts else 1
# Work-memory overlay (derived sidecar). When not passed explicitly, load it
# best-effort from the sibling .graphify_learning.json next to the output
# graph.html (which lives beside graph.json). Empty/missing => no learning
# fields, so the un-annotated render is byte-identical to pre-feature.
if learning_overlay is None:
learning_overlay = {}
try:
from graphify.reflect import load_learning_overlay as _lloView on GitHub (pinned to 7fe58b0b0f)
Solutions
- Re-run with --no-viz to skip HTML generation entirely
- Raise the cap for this run: GRAPHIFY_VIZ_NODE_LIMIT=200000 graphify ... (size it to your machine — the browser, not graphify, is the bottleneck)
- Use the aggregated community view (the exporter prints 'aggregated: N community nodes') or --obsidian for node-level detail without the interactive viz
- Reduce input size: index a subdirectory or exclude vendored/generated code
Example fix
# before GRAPHIFY_VIZ_NODE_LIMIT=5000 graphify build . # ValueError: Graph has 12000 nodes - too large # after graphify build . --no-viz # or GRAPHIFY_VIZ_NODE_LIMIT=20000 graphify build .
Defensive patterns
Strategy: validation
Validate before calling
import os
from graphify.exporters.html import _viz_node_limit # or read env directly
limit = int(os.environ.get("GRAPHIFY_VIZ_NODE_LIMIT", "100000"))
if G.number_of_nodes() > limit:
print(f"{G.number_of_nodes()} nodes > limit {limit}; skipping HTML viz")
else:
export_html(G, communities, "graph.html") Try / catch
try:
export_html(G, communities, "graph.html")
except ValueError as e:
if "too large for HTML viz" in str(e):
# fall back to a lighter-weight export
export_dot(G, "graph.dot")
else:
raise Prevention
- Use --no-viz in automation over large repos so builds never depend on the cap
- Set GRAPHIFY_VIZ_NODE_LIMIT explicitly (per machine) rather than relying on the default
- Check G.number_of_nodes() before calling HTML export in your own pipeline code
When it happens
Trigger: Calling the HTML export entry point on a graph where G.number_of_nodes() > limit (from GRAPHIFY_VIZ_NODE_LIMIT) and the community-aggregated path was not selected (aggregation only triggers above its own threshold/flag, or communities are absent so remapping is skipped).
Common situations: Running graphify on a large monorepo or a merged global graph; lowering the default limit in CI to speed builds; forgetting --no-viz in a cron job over a big codebase.
Related errors
- graph file {path} is {size:_d} bytes, exceeds {cap:_d}-byte
- matplotlib not installed. Run: pip install matplotlib
- git hooks path from {source} looks like a Windows path: {val
- No LLM backend configured. Set one of: GEMINI_API_KEY, ANTHR
- Unknown backend {backend!r}. Available: {sorted(BACKENDS)}
AI-assisted analysis of Graphify-Labs/graphify@7fe58b0b0f (2026-08-14).
Data as JSON: /api/errors/373b7e53028f5c0f.
Report an issue: GitHub.