{"record":{"id":"c4582368d55e2c8a","repo":"Graphify-Labs/graphify","slug":"error-multigraph-requires-networkx-keyed-multid","errorCode":null,"errorMessage":"error: --multigraph requires NetworkX keyed MultiDiGraph node-link round-trip support. Detected Python {python_version}, NetworkX {networkx_version}. Failed capability check(s): {failed}. Default simple graph mode remains available.","messagePattern":"error: --multigraph requires NetworkX keyed MultiDiGraph node-link round-trip support\\. Detected Python (.+?), NetworkX (.+?)\\. Failed capability check\\(s\\): (.+?)\\. Default simple graph mode remains available\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"graphify/multigraph_compat.py","lineNumber":211,"sourceCode":"        ),\n        _check(\n            \"to_undirected_preserves_multigraph_type\",\n            _probe_to_undirected_preserves_multigraph_type,\n        ),\n    )\n    return MultigraphCapabilityResult(\n        python_version=(\n            f\"{sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}\"\n        ),\n        networkx_version=nx.__version__,\n        checks=checks,\n    )\n\n\ndef require_multigraph_capabilities() -> MultigraphCapabilityResult:\n    result = probe_multigraph_capabilities()\n    if not result.ok:\n        raise RuntimeError(result.error_message())\n    return result\n","sourceCodeStart":193,"sourceCodeEnd":213,"githubUrl":"https://github.com/Graphify-Labs/graphify/blob/7fe58b0b0f3873be9a21c30106b8b8527c353aa6/graphify/multigraph_compat.py#L193-L213","documentation":"RuntimeError raised by require_multigraph_capabilities() when probe_multigraph_capabilities() reports that the running Python/NetworkX combination cannot round-trip keyed MultiDiGraph node-link data (the --multigraph feature). The composed message embeds Python version, NetworkX version, and the specific failed capability checks, then notes that simple-graph mode remains available.","triggerScenarios":"Running graphify with --multigraph when the environment probe fails (multigraph_compat.py:207-211): the installed NetworkX predates (or deviates from) the keyed-multigraph node-link format support, or the Python version interacts badly with it. The exact failing checks are listed in the message.","commonSituations":"NetworkX pinned below ~3.x where node-link data lacked keyed multigraph edge support; downstream apps freezing old networkx versions; upgrading Python (e.g. to a brand-new minor) while a vendored old networkx stays; mixing conda-forge and pip networkx installs.","solutions":["Upgrade NetworkX to the documented minimum: `pip install -U networkx`.","Read the failed checks in the message - if the probe names a specific serialization gap, match the version graphify was tested against (see its requirements).","If you cannot upgrade, drop --multigraph and run in default simple-graph mode, which the message confirms stays available."],"exampleFix":"# before\n$ graphify build --multigraph   # RuntimeError: requires NetworkX keyed MultiDiGraph...\n\n# after\n$ pip install -U networkx\n$ graphify build --multigraph\n# or, if the pin cannot move:\n$ graphify build   # simple graph mode","handlingStrategy":"validation","validationCode":"from graphify.multigraph_compat import probe_multigraph_capabilities\nresult = probe_multigraph_capabilities()\nif not result.ok:\n    print(f\"--multigraph unavailable: {result.error_message()}\")\n    print(\"Falling back to simple graph mode.\")\n    use_multigraph = False\nelse:\n    use_multigraph = True","typeGuard":null,"tryCatchPattern":"try:\n    result = require_multigraph_capabilities()\nexcept RuntimeError as exc:\n    raise SystemExit(f\"{exc}\\nRun without --multigraph, or upgrade networkx.\") from exc","preventionTips":["Pin networkx to the graphify-documented minimum in requirements so CI cannot drift.","Call the probe at startup and degrade to simple-graph mode with a warning instead of crashing batch jobs.","After Python upgrades, re-run the capability probe - it is cheap."],"tags":["dependencies","networkx","version","multigraph","python"],"backgroundTag":null,"analyzedSha":"7fe58b0b0f3873be9a21c30106b8b8527c353aa6","analyzedAt":"2026-08-14T19:23:21.323Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}