java.lang.IllegalArgumentException error

I am trying to run the following code.

CALL gds.graph.create.cypher(
    'MATCH (n:Person) RETURN id(n) AS id',
    'MATCH (a:Person)-[:LIKES]->(b:Person) RETURN id(a) AS source, id(b) AS target'
YIELD graphName, nodeCount, relationshipCount, createMillis;

But I got this error: Neo.ClientError.Procedure.ProcedureCallFailed

Failed to invoke procedure gds.graph.create.cypher: Caused by: java.lang.IllegalArgumentException: Node-Query returned no nodes

Can you please help?

It's in the error message: your first query doesn't contain any nodes. Try running MATCH (n:Person) RETURN COUNT(n) to double check your cypher.

1 Like

Thanks Alicia. You are right. This was happening because the db had 0 nodes. The gds.graph.create.cypher function actually does not CREATE the nodes.