Bug Description
Summary
cognee.api.v1.visualize.visualize.visualize_graph() reports "No nodes found in the database"
and produces an empty HTML, while cognee.search() on the same kernel session returns the
full populated graph. The root cause is that visualize_graph() calls
get_graph_engine() without resolving the user's dataset, so it opens the default
(empty) graph DB instead of the per-dataset DB that cognify() actually wrote to.
Environment
- cognee version: <run
pip show cognee | grep Version and paste>
- Python: 3.12
- Platform: Google Colab
- Graph DB provider: ladybug (default)
- LLM provider: anthropic
- Embedding provider: fastembed (sentence-transformers/all-MiniLM-L6-v2, 384 dim)
Repro
import cognee, os
from cognee import SearchType
os.environ["LLM_API_KEY"] = "<key>"
cognee.config.set_llm_provider("anthropic")
cognee.config.set_llm_model("anthropic/claude-sonnet-4-20250514")
cognee.config.set_embedding_provider("fastembed")
cognee.config.set_embedding_model("sentence-transformers/all-MiniLM-L6-v2")
cognee.config.set_embedding_dimensions(384)
doc_text = "OmniTech Corp utilizes Aurora-Pay hosted on AWS. Sarah Jenkins leads the DevOps team and assigned a ticket to David Cho."
await cognee.prune.prune_data()
await cognee.prune.prune_system(metadata=True)
await cognee.add(doc_text)
await cognee.cognify()
# This works — returns 27 nodes, 40+ edges:
result = await cognee.search(
query_text="MATCH (n)-[r]->(m) RETURN n, r, m",
query_type=SearchType.CYPHER,
)
print(len(result[0]["search_result"])) # > 0
# This fails — "No nodes found in the database":
from cognee.api.v1.visualize.visualize import visualize_graph
await visualize_graph(destination_file_path="graph.html")
Diagnosis
The default graph engine points at the install-dir default DB:
/usr/local/lib/python3.12/dist-packages/cognee/.cognee_system/databases/cognee_graph_ladybug
But cognify() wrote data to the per-dataset DB:
./.cognee_system/databases/<dataset_uuid>/<some_uuid>.lbug (1.6 MB)
visualize_graph() body:
async def visualize_graph(destination_file_path: str = None) -> str:
graph_engine = await get_graph_engine() # <-- no dataset context
graph_data = await graph_engine.get_graph_data()
...
Compare with search(), which resolves get_default_user() and the authorized
datasets before constructing a dataset-scoped engine.
Suggested fix
visualize_graph() should mirror search()'s dataset resolution path so the
returned engine points at the dataset's actual DB file. Roughly:
async def visualize_graph(destination_file_path=None, datasets=None, user=None):
user, datasets = await resolve_authorized_user_datasets(datasets, user)
# build engine for these datasets, then get_graph_data()
...
Workaround
Pull the graph through CYPHER and feed cognee_network_visualization directly:
from cognee.modules.visualization.cognee_network_visualization import cognee_network_visualization
results = await cognee.search(
query_text="MATCH (n)-[r]->(m) RETURN n, r, m",
query_type=SearchType.CYPHER,
)
# reshape into (nodes, edges) tuple and call cognee_network_visualization(...)
Happy to send a PR if there's interest.
Steps to Reproduce
- Configure cognee with Anthropic LLM + fastembed embeddings on Google Colab:
import cognee, os
from cognee import SearchType
os.environ["LLM_API_KEY"] = "<your-key>"
cognee.config.set_llm_provider("anthropic")
cognee.config.set_llm_model("anthropic/claude-sonnet-4-20250514")
cognee.config.set_embedding_provider("fastembed")
cognee.config.set_embedding_model("sentence-transformers/all-MiniLM-L6-v2")
cognee.config.set_embedding_dimensions(384)
- Add some text and cognify:
doc_text = "OmniTech Corp utilizes Aurora-Pay hosted on AWS. Sarah Jenkins leads the DevOps team and assigned a ticket to David Cho."
await cognee.prune.prune_data()
await cognee.prune.prune_system(metadata=True)
await cognee.add(doc_text)
await cognee.cognify()
- Confirm graph exists via CYPHER search — returns 27 nodes, 40+ edges:
result = await cognee.search(
query_text="MATCH (n)-[r]->(m) RETURN n, r, m",
query_type=SearchType.CYPHER,
)
print(len(result[0]["search_result"])) # > 0
- Try to visualize the same graph — fails with "No nodes found":
from cognee.api.v1.visualize.visualize import visualize_graph
await visualize_graph(destination_file_path="graph.html")
- Observe log output:
Expected Behavior
visualize_graph() should render the same graph that cognee.search() returns
on the same kernel session — in this case 27 nodes and 40+ edges from the cognified
document. The output HTML should contain populated nodes and links arrays
and render the interactive D3 graph view.
Actual Behavior
visualize_graph() reports "No nodes found in the database" and writes an HTML
file with empty nodes and links arrays, even though cognee.search() on the
same dataset, same session, returns the full graph through the CYPHER and
GRAPH_COMPLETION search types.
Root cause: visualize_graph() calls get_graph_engine() without resolving the
user's dataset, so it opens the default install-dir DB instead of the per-dataset
DB that cognify() wrote to.
The default engine points at:
/usr/local/lib/python3.12/dist-packages/cognee/.cognee_system/databases/cognee_graph_ladybug
But cognify wrote data to (1.6 MB):
./.cognee_system/databases/<dataset_uuid>/<file_uuid>.lbug
Compare visualize_graph() body:
async def visualize_graph(destination_file_path: str = None) -> str:
graph_engine = await get_graph_engine() # no dataset context
graph_data = await graph_engine.get_graph_data()
...
with search(), which calls resolve_authorized_user_datasets() first and
builds a dataset-scoped engine.
Suggested fix: have visualize_graph() accept optional datasets / user
kwargs (matching search()) and resolve them before building the engine.
Workaround that works:
from cognee.modules.visualization.cognee_network_visualization import cognee_network_visualization
results = await cognee.search(
query_text="MATCH (n)-[r]->(m) RETURN n, r, m",
query_type=SearchType.CYPHER,
)
# Reshape triples into (nodes, edges) tuple and call cognee_network_visualization()
Environment
- cognee version: <run
pip show cognee | grep Version>
- Python: 3.12
- Platform: Google Colab
- Graph DB provider: ladybug (default)
- Vector DB provider: lancedb (default)
- LLM provider: anthropic
- Embedding provider: fastembed (sentence-transformers/all-MiniLM-L6-v2, 384 dim)
Logs/Error Messages
Additional Context
Expected behavior - visualize_graph() should render the same graph that cognee.search() returns
on the same kernel session — in this case 27 nodes and 40+ edges from the cognified
document. The output HTML should contain populated nodes and links arrays
and render the interactive D3 graph view.
Pre-submission Checklist
Bug Description
Summary
cognee.api.v1.visualize.visualize.visualize_graph()reports "No nodes found in the database"and produces an empty HTML, while
cognee.search()on the same kernel session returns thefull populated graph. The root cause is that
visualize_graph()callsget_graph_engine()without resolving the user's dataset, so it opens the default(empty) graph DB instead of the per-dataset DB that
cognify()actually wrote to.Environment
pip show cognee | grep Versionand paste>Repro
Diagnosis
The default graph engine points at the install-dir default DB:
/usr/local/lib/python3.12/dist-packages/cognee/.cognee_system/databases/cognee_graph_ladybug
But
cognify()wrote data to the per-dataset DB:./.cognee_system/databases/<dataset_uuid>/<some_uuid>.lbug (1.6 MB)
visualize_graph()body:Compare with
search(), which resolvesget_default_user()and the authorizeddatasets before constructing a dataset-scoped engine.
Suggested fix
visualize_graph()should mirrorsearch()'s dataset resolution path so thereturned engine points at the dataset's actual DB file. Roughly:
Workaround
Pull the graph through CYPHER and feed
cognee_network_visualizationdirectly:Happy to send a PR if there's interest.
Steps to Reproduce
Expected Behavior
visualize_graph()should render the same graph thatcognee.search()returnson the same kernel session — in this case 27 nodes and 40+ edges from the cognified
document. The output HTML should contain populated
nodesandlinksarraysand render the interactive D3 graph view.
Actual Behavior
visualize_graph()reports "No nodes found in the database" and writes an HTMLfile with empty
nodesandlinksarrays, even thoughcognee.search()on thesame dataset, same session, returns the full graph through the CYPHER and
GRAPH_COMPLETION search types.
Root cause:
visualize_graph()callsget_graph_engine()without resolving theuser's dataset, so it opens the default install-dir DB instead of the per-dataset
DB that
cognify()wrote to.The default engine points at:
/usr/local/lib/python3.12/dist-packages/cognee/.cognee_system/databases/cognee_graph_ladybugBut cognify wrote data to (1.6 MB):
./.cognee_system/databases/<dataset_uuid>/<file_uuid>.lbugCompare
visualize_graph()body:with
search(), which callsresolve_authorized_user_datasets()first andbuilds a dataset-scoped engine.
Suggested fix: have
visualize_graph()accept optionaldatasets/userkwargs (matching
search()) and resolve them before building the engine.Workaround that works:
Environment
pip show cognee | grep Version>Logs/Error Messages
Additional Context
Expected behavior -
visualize_graph()should render the same graph thatcognee.search()returnson the same kernel session — in this case 27 nodes and 40+ edges from the cognified
document. The output HTML should contain populated
nodesandlinksarraysand render the interactive D3 graph view.
Pre-submission Checklist