Cannot RESET after a `Neo.ClientError.Request.Invalid` FAILURE

Hello,
I'm working on a driver and experiencing strange behaviours.
An invalid query returns a FAILURE from the server.
After that, I am able to send a RESET and everything is fine

C: RUN ~ ["RETRN 1 AS num", %{}, %{}]
S: FAILURE ~ %{"code" => "Neo.ClientError.Statement.SyntaxError", "message" => "Invalid input 'R': expected 'u/U' (line 1, column 4 (offset: 3))\n\"RETRN 1 AS num\"\n    ^"}
C: RESET ~ []

But with FAILURES occurring after bad COMMIT, ROLLBACK, connection is closed and I am not able to send RESET.
Ex:

C: ROLLBACK ~ []
S: FAILURE ~ %{"code" => "Neo.ClientError.Request.Invalid", "message" => "Message 'ROLLBACK' cannot be handled by a session in the READY state."}

My question is: Is it the server which closes connection or it is a problem in my driver?
Or maybe it's related to the failure kind syntax.Error vs Request.Invalid?

Thanks for your help.

1 Like

Has someone faced this issue?

Print the cypher and try running it in Neo4j Desktop and the actual error may reveal itself. I was getting this error in Python stack trace, but the actual error was only directional relationships in CREATE -- in other words, I had a typo in my cypher.

When you look at the Bolt message state transitions in version 5.1, you see the following: if current state is "READY", and client sends "RUN", and server responds with "FAILURE", than the new state is "FAILED". That's the case if the Cypher you sent via RUN contains a syntaxError.

Now, if you look for current state "FAILED", there's no (sic!) client command which results in a new state "READY". In short words: from state "FAILED", there's no way back. You either stay at "FAILED", or you drop out to "DEFUNCT".

My "solution": close connection after "FAILED", and start a new one ...