You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
File ".../graphify/benchmark.py", line 105, in run_benchmark
G = json_graph.node_link_graph(data, edges="links")
...
File ".../networkx/readwrite/json_graph/node_link.py", line 247, in node_link_graph
for d in data[edges]:
KeyError: 'links'
Root cause
The graph.json written by extract stores edges under the edges key, not links:
But benchmark.py calls json_graph.node_link_graph(data, edges="links") with the literal old key. On networkx ≥3.x the hardcoded "links" no longer matches what extract emits, so data["links"] raises KeyError.
Suggested fix
Pass edges="edges" to match the extract output (or detect the present key):
G=json_graph.node_link_graph(data, edges="edges")
Notes
Reproduced on a --no-cluster raw extraction; haven't checked clustered output, which may differ.
Otherwise the tool is great — extract on a code-only corpus is fast and fully offline (a 47-file TS app → 247 nodes/470 edges in ~2.3s, zero API calls). Just wanted the benchmark token-reduction numbers and hit this. Thanks!
Update: this bug is wider than benchmark — the same node_link_graph(data, edges="links") vs the edges-keyed graph.json also breaks affected (and any command going through that load path). On networkx 3.6.1, graphify affected "<node>" fails with:
error: could not load graph: 'links'
Root cause: the writer emits "edges" (build.py reads the JSON directly — see the comment at build.py:384), but the readers call node_link_graph(..., edges="links") → KeyError: 'links', which the surrounding except TypeError: (the old-networkx missing-kwarg guard) doesn't catch.
Fix is one token at each site — edges="links" → edges="edges" (match the writer's key). Verified locally on networkx 3.6.1: patching affected.py + benchmark.py made both commands work correctly — affected returns the full reverse-dependency cone, and benchmark reports its token-reduction metric (2.6× on a real Next.js/TS repo). query/explain/path already work because they read the JSON directly rather than via node_link_graph. Happy to send a PR if that's useful.
Not a bug — the claim has the keys inverted. graph.json stores edges under "links" (written by export.py:512 via node_link_data(G, edges="links")), and benchmark.py:105 correctly reads edges="links". Verified on networkx 3.6.1: all 16 benchmark tests pass. Applying the suggested fix (edges="edges") would introduce the crash, not fix it.
Activity
atlas-architect commentedon Jun 8, 2026
Update: this bug is wider than
benchmark— the samenode_link_graph(data, edges="links")vs theedges-keyedgraph.jsonalso breaksaffected(and any command going through that load path). On networkx 3.6.1,graphify affected "<node>"fails with:Root cause: the writer emits
"edges"(build.py reads the JSON directly — see the comment atbuild.py:384), but the readers callnode_link_graph(..., edges="links")→KeyError: 'links', which the surroundingexcept TypeError:(the old-networkx missing-kwarg guard) doesn't catch.Same pattern at ~9 call-sites:
affected.py:152,benchmark.py:105,callflow_html.py:231,global_graph.py:37+:91,multigraph_compat.py:115,serve.py:33, and__main__.py(lines 2702 / 2840 / 2930 / 3405 / 3463 / 3653).Fix is one token at each site —
edges="links"→edges="edges"(match the writer's key). Verified locally on networkx 3.6.1: patchingaffected.py+benchmark.pymade both commands work correctly —affectedreturns the full reverse-dependency cone, andbenchmarkreports its token-reduction metric (2.6× on a real Next.js/TS repo).query/explain/pathalready work because they read the JSON directly rather than vianode_link_graph. Happy to send a PR if that's useful.safishamsi commentedon Jun 8, 2026
Not a bug — the claim has the keys inverted.
graph.jsonstores edges under"links"(written byexport.py:512vianode_link_data(G, edges="links")), andbenchmark.py:105correctly readsedges="links". Verified on networkx 3.6.1: all 16 benchmark tests pass. Applying the suggested fix (edges="edges") would introduce the crash, not fix it.