A database adapter can pass every write test and still crash the moment you ask to read back the graph it just built.
When you create an edge in a property graph, the database already links the source and target nodes. An adapter does not need to duplicate those node IDs inside the edge's own key-value properties. During a canary evaluation of cognee-community-hybrid-adapter-falkor v0.4.0 against FalkorDB 4.12.5 and Cognee 1.6.1, writes never stored those duplicate IDs on the edge, yet the full-graph read looked for them inside properties(r) instead of reading the connected nodes. Adding nodes and edges succeeded on an empty graph, and the very next full-graph read crashed with KeyError: 'source_node_id'.
Where the write and read assumptions diverged
Tracing falkor_adapter.py exposed the split directly. When add_edge() (via create_edge_query()) and add_edges() wrote a relationship, they persisted relationship_name, updated_at, and caller properties through SET r += e.props. Neither write path ever stored source_node_id or target_node_id as properties on the edge itself.
On the read path, however, get_graph_data() queried the edge's property map and immediately indexed record[3]["source_node_id"] and record[3]["target_node_id"]:
MATCH (n)-[r]->(m)
RETURN ID(n) AS source, ID(m) AS target, TYPE(r) AS type, properties(r) AS propertiesOther call sites in the same file used .get() fallbacks, which masked the mismatch until an unfiltered read ran on a graph with at least one edge. That single assumption broke GET /v1/datasets/{id}/graph visualization with HTTP 500 on any populated dataset, as well as get_filtered_graph_data([]) whenever called without filters.
Why edge properties were the wrong place to look
Even backfilling those keys on write would have left a subtler trap in migrated data. In graphs imported from postgres_graph, properties(r) can carry a nested properties JSON string whose embedded source_node_id or target_node_id disagrees with the actual bound nodes in FalkorDB.
The durable fix is to stop asking the edge's property bag who its endpoints are. Because the Cypher pattern already binds both connected nodes, returning n.id and m.id directly from the graph is authoritative and works retroactively on migrated edges without rewriting the database:
MATCH (n)-[r]->(m)
RETURN n.id AS source, m.id AS target, TYPE(r) AS type, properties(r) AS propertiesWhile inspecting that same read path on larger datasets, a second boundary surfaced. FalkorDB enforces a default RESULTSET_SIZE of 10,000 rows, which silently truncated get_graph_data() on a graph with roughly 20,000 nodes and 37,000 edges without raising an error.
Upstream fix and local verification boundary
I reported the defect in Cognee community #262 on 7 October 2026. Maintainers closed the issue as completed on 14 October 2026 by merging PR #299, which reads edge endpoints from the returned node IDs and adds a unit test. A separate proposal in PR #329 remains open upstream and should not be confused with the merged fix.
In our own deployment, we carried a local sitecustomize.py monkey-patch (falkor_adapter_patch.py) alongside fixes for seven sibling v0.4.0 adapter issues and covered the patched behavior with 22 unit tests. A local monkey-patch with unit tests validates our runtime workaround, not a published PyPI release containing PR #299 or an unpatched upstream adapter in our cluster.
Public sources
- Cognee #262github.com
- Cognee PR #299github.com
- Cognee PR #329github.com
