CypherError and a Typo:
🐛 Describe the bug
The minimal working example in Colab is not working. Here's my configs of neo4j:
neo4j:
image: neo4j:5.18.0
container_name: neo4j-enterprise-dev
ports:
- "7474:7474" # HTTP
- "7687:7687" # Bolt
environment:
NEO4J_AUTH: neo4j/password
NEO4J_ACCEPT_LICENSE_AGREEMENT: "yes"
NEO4J_PLUGINS: '["apoc","graph-data-science","bloom"]'
NEO4J_dbms_security_procedures_unrestricted: apoc.*,gds.*,bloom.*
NEO4J_apoc_export_file_enabled: "true"
NEO4J_apoc_import_file_enabled: "true"
NEO4J_server_directories_logs: /logs
# ← here are the two correct settings:
NEO4J_dbms_default__database: neo4j
volumes:
- ./data:/data
- ./import:/var/lib/neo4j/import
- ./plugins:/plugins
- ./logs:/logs
Here's my credentials, running for other container:
URL = "bolt://neo4j:7687"
USERNAME = "neo4j"
PASSWORD = "password"
Then after running the example in m.add the error happens:
CypherSyntaxError: {code: Neo.ClientError.Statement.SyntaxError} {message: Invalid input '(': expected "{" (line 6, column 18 (offset: 296))
" CALL (n) {"
^}
The current version is mem0ai==0.1.98 I've solved the error. Here's the corrected cypher query:
cypher_query = """
MATCH (n)
WHERE n.embedding IS NOT NULL AND n.user_id = $user_id
WITH n, round(2 * vector.similarity.cosine(n.embedding, $n_embedding) - 1, 4) AS similarity
WHERE similarity >= $threshold
CALL {
WITH n
MATCH (n)-[r]->(m)
RETURN n.name AS source, elementId(n) AS source_id, type(r) AS relationship, elementId(r) AS relation_id, m.name AS destination, elementId(m) AS destination_id
UNION
WITH n
MATCH (m)-[r]->(n)
RETURN m.name AS source, elementId(m) AS source_id, type(r) AS relationship, elementId(r) AS relation_id, n.name AS destination, elementId(n) AS destination_id
}
WITH DISTINCT source, source_id, relationship, relation_id, destination, destination_id, similarity
RETURN source, source_id, relationship, relation_id, destination, destination_id, similarity
ORDER BY similarity DESC
LIMIT $limit
"""
Before the correction it was:
(...)
CALL (n) {
MATCH (n)-[r]->(m)
RETURN n.name AS source, elementId(n) AS source_id, type(r) AS relationship, elementId(r) AS relation_id, m.name AS destination, elementId(m) AS destination_id
However, another error appeared: m.add("I hate playing badminton", user_id=user_id), display_graph() Again, I've fixed it. In utils.py, the function format_entities it was written relatationship instead of relationship .
Could you guys fix it?
I'm having the same issue.
The issue was resolved by using the latest version of neo4j:2025.04 for me.
Closing as resolved.