circlemind-ai / fast-graphrag

RAG that intelligently adapts to your use case, data, and queries
MIT License
1.98k stars 84 forks source link

invalid edge id #7

Closed manishiitg closed 1 week ago

manishiitg commented 2 weeks ago
Error during insertion: Error at src/graph/iterators.c:1999: Cannot create iterator, invalid edge ID. -- Invalid value
Traceback (most recent call last):
  File "/Users/mipl/ramen/backend/fast-graph-rag/main.py", line 42, in <module>
    grag.insert(f.read())
  File "/Users/mipl/ramen/backend/fast-graph-rag/fast-graphrag/fast_graphrag/_graphrag.py", line 53, in insert
    return get_event_loop().run_until_complete(self.async_insert(content, metadata))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.12/3.12.3/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/base_events.py", line 687, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/Users/mipl/ramen/backend/fast-graph-rag/fast-graphrag/fast_graphrag/_graphrag.py", line 99, in async_insert
    raise e
  File "/Users/mipl/ramen/backend/fast-graph-rag/fast-graphrag/fast_graphrag/_graphrag.py", line 96, in async_insert
    await self.state_manager.upsert(llm=self.llm_service, subgraphs=subgraphs, documents=new_chunks_per_data)
  File "/Users/mipl/ramen/backend/fast-graph-rag/fast-graphrag/fast_graphrag/_services/_state_manager.py", line 96, in upsert
    _, _ = await self.edge_upsert_policy(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/mipl/ramen/backend/fast-graph-rag/fast-graphrag/fast_graphrag/_policies/_graph_upsert.py", line 305, in __call__
    return target, chain(*await asyncio.gather(*edge_upsert_tasks))
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/mipl/ramen/backend/fast-graph-rag/fast-graphrag/fast_graphrag/_policies/_graph_upsert.py", line 211, in _upsert_edge
    upserted_eges = await self._merge_similar_edges(llm, target, existing_edges, edges)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/mipl/ramen/backend/fast-graph-rag/fast-graphrag/fast_graphrag/_policies/_graph_upsert.py", line 288, in _merge_similar_edges
    await target.delete_edges_by_index([i for i, v in indices_to_delete.items() if v])
  File "/Users/mipl/ramen/backend/fast-graph-rag/fast-graphrag/fast_graphrag/_storage/_gdb_igraph.py", line 120, in delete_edges_by_index
    self._graph.delete_edges(indices)  # type: ignore
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/mipl/ramen/backend/venv/lib/python3.12/site-packages/igraph/basic.py", line 158, in _delete_edges
    return GraphBase.delete_edges(graph, edge_seq)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
igraph._igraph.InternalError: Error at src/graph/iterators.c:1999: Cannot create iterator, invalid edge ID. -- Invalid value
liukidar commented 2 weeks ago

Hello, there was a race condition going on, hopefully that is fixed now. I have updated the main branch. Let me know.