Skip to content

graphify query fails on NetworkX < 3.4: node_link_graph() got an unexpected keyword argument 'edges' #95

Closed

Description

@ross-jill-ws

Bug description

Running graphify query against an existing graph fails immediately with:

error: could not load graph: node_link_graph() got an unexpected keyword argument 'edges'

Minimal reproduction:

pip install 'networkx<3.4'
graphify query "some question" --graph graphify-out/graph.json

The same failure will occur for graphify serve and graphify benchmark, which use the same call pattern.

Root cause

The edges= keyword argument on networkx.readwrite.json_graph.node_link_graph() was only introduced in NetworkX 3.4 (as part of the links → edges key rename migration). On any environment with NetworkX ≤ 3.3, passing edges=\"links\" raises TypeError.

Affected call sites in the codebase:

  • graphify/__main__.py:505 — in the query subcommand
  • graphify/serve.py:15
  • graphify/benchmark.py:79
  • Skill instruction templates embed the same pattern (skill.md, skill-codex.md, skill-droid.md, skill-opencode.md, skill-trae.md, skill-claw.md, skill-windows.md), so any skill-driven execution path hits the same bug.

pyproject.toml / install requirements do not appear to pin networkx>=3.4, so older versions are reachable through a normal install.

Suggested fix

There is already precedent for version-safe NetworkX shims in this repo (commit b64c231, "louvain kwargs version-safe"). The same pattern fits here — a small helper used at every call site:

def _load_node_link(data):
    try:
        return json_graph.node_link_graph(data, edges=\"links\")
    except TypeError:
        # NetworkX < 3.4: 'edges' kwarg did not exist; \"links\" was the default link key
        return json_graph.node_link_graph(data)

Alternatively (or additionally), pin networkx>=3.4 in pyproject.toml to make the requirement explicit.

The skill markdown templates should be updated in lockstep so skill-driven flows stay consistent with the Python code.

Activity

  1. safishamsi commented on Apr 8, 2026

    @safishamsi
    Member

    Fixed in v0.3.16 — version-safe shim added at all three call sites (main.py, serve.py, benchmark.py). Falls back to no-kwarg form on NetworkX < 3.4.

  2. may865521-web commented on Apr 14, 2026

    @may865521-web

    this bug still exist
    ⎿  Error: Exit code 1
    Traceback (most recent call last):
    File "", line 8, in
    File "D:\program\anaconda3\Lib\site-packages\networkx\utils\backends.py", line 412, in call
    return self.orig_func(*args, **kwargs)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    TypeError: node_link_graph() got an unexpected keyword argument 'edges'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions