# Transaction error

**URL:** <https://community.neo4j.com/t/transaction-error/64929>\
**Category:** Neo4j Graph Platform\
**Created:** [November 11, 2023, 10:45am UTC](https://community.neo4j.com/t/transaction-error/64929 "2023-11-11T10:45:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![a.123welldone](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/a.123welldone/32/29856_2.png) [@a.123welldone](https://community.neo4j.com/u/a.123welldone)\
**Post date:** [November 11, 2023, 10:45am UTC](https://community.neo4j.com/t/transaction-error/64929/1 "2023-11-11T10:45:06Z")

</div>

When I tried to use py2neo to create 400000 nodes and 800000 relationships at once, this error occurred: [Transaction.TransactionNotFound] Unrecognized transaction id. Transaction may have timed out and been rolled back.  
The original code is as follows:  
tx = graph.begin()  
tx.create(subgraph=Subgraph(nodes=all\_nodes))  
for i in range(0,int(len(all\_create\_relationships)/single\_summit\_value)+1):  
start=i\*single\_summit\_value  
end=(i+1)\*single\_summit\_value  
if end\>len(all\_create\_relationships):  
end=len(all\_create\_relationships)  
try:  
subgraph=Subgraph(relationships=all\_create\_relationships[start:end])  
tx.create(subgraph)

```
        except Exception as e:
            graph.rollback(tx)
            print(f"Transaction rolled back: {e}")

    graph.commit(tx)

```
