Neo.ClientError.Statement.ParameterMissing} {message: Expected parameter(s): username_} with Python

I have the following function and the following call (with the connection setup before it)

from  neo4j import GraphDatabase
from pypher import Pypher
# from WebScraper import *
py = Pypher()
# server connection link
uri = "bolt://localhost:7687"
driver = GraphDatabase.driver(uri, auth=("neo4j", "cs411fpl"))
session = driver.session()
username = 'a'
varray = []
# adds a user node
def add_user(username_):
    q1 = "CREATE (u:User) SET $username_"
    nodes =


This leads to the error:

File "", line 37, in <module>
File "", line 14, in add_user
    nodes =
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/neo4j/work/", line 217, in run
    self._autoResult._run(query, parameters, self._config.database, self._config.default_access_mode, self._bookmarks, **kwparameters)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/neo4j/work/", line 101, in _run
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/neo4j/work/", line 202, in _attach
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/neo4j/io/", line 363, in fetch_message
    response.on_failure(summary_metadata or {})
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/neo4j/io/", line 179, in on_failure
    raise Neo4jError.hydrate(**metadata)

neo4j.exceptions.ClientError: {code: Neo.ClientError.Statement.ParameterMissing} {message: Expected parameter(s): username_}

Any suggestions would be great. Thanks!

Hi @rushill2,

Welcome to the Neo4j Community forum!

It looks like your add_user function is not passing along the parameter to to

To pass parameters along with the query, provide them in the call to For example:

nodes =, _username = _username)

For more details and example code, see Create applications with Neo4j - Neo4j Documentation.

If this was helpful, later when your experience with Neo4j grows, please return to help someone else. :slight_smile: