Geting Error Neo.TransientError.General.StackOverFlowError

Hi Everyone,

i am getting below error on running some query .

Neo.TransientError.General.StackOverFlowError: There is not enough stack size to perform the current task. This is generally considered to be a database error, so please contact Neo4j support. You could try increasing the stack size: for example to set the stack size to 2M, add `dbms.jvm.additional=-Xss2M' to in the neo4j configuration (normally in 'conf/neo4j.conf' or, if you are using Neo4j Desktop, found through the user interface) or if you are running an embedded installation just add -Xss2M as command line flag

this error is not coming everytime , it is coming when i want to convert my data as json tree path .
could you please suggest me what is wrong with this .
I have added dbms.jvm.additional=-Xss2M in my conf file still getting same error.


Please share with us the code you're using to do the JSON conversion, and maybe a sample of the data in question.

Usually this sort of thing is going to be caused by unbounded recursion, where a function is calling itself and not terminating, adding to the stack until the stack overflows.

Hi david Thanks for your reply
Please find below cypher query

WITH collect(a) as nodes
With last(nodes) as m
MATCH PATH = (m)<-[*]-(l)
with collect(PATH) as paths 
call apoc.convert.toTree(paths) yield value return value

and data is like in tree format
in the top i have a node that is m in the query and this m have 6 child nodes and each child node have some childs .

Please let me know if i missed anything

I'm not sure. But I'm guessing you may have cycles in your tree. @michael.hunger - do you know if apoc.convert.toTree handles this case?

Hi david,

please find below my data modal

Here Each node have same label and different properties . it has a unique property BARCODE
my requirement is if i give any barcode in query i should get whole graph in json as output

Hi Kunal,
Am also facing the same issue , did you got ny solution for the same.
I am also trying to find a solution but couldn't till now.