Knowledge Base

Explanation of error "Unrecognized transaction id. Transaction may have timed out and been rolled back"

When submitting a request via the Neo4j Transactional Cypher HTTP endpoint, one may encounter the following error

Unrecognized transaction id.
Transaction may have timed out and been rolled back

This error may occur as a result of the transactions expiration date/time being met. By default, org.neo4j.server.transaction.timeout describes the number of seconds whereby inactivity in a transaction will result in the transaction automatically rolling back. The default is 60 seconds but can be overridden by adding

org.neo4j.server.transaction.timeout=XXX

where XXX represents number of seconds, to the conf/neo4j-server.properties and then restarting neo4j via bin/neo4j restart.

Alternatively one can either, keep the transaction open by periodically performing a keep-alive via the REST API and as described via  /db/data/transaction/XXX, or committing the transaction sooner by /db/data/transaction/XXX/commit where XXX represents the transaction number

Note bin/neo4j-shell does not utilize the REST API and as such the org.neo4j.server.transaction.timeout has no effect on transactions created within a begin commit within neo4j-shell.