groovy Jahia 7.3 Jahia 8

Item does not exist anymore


The customer has created a Groovy script to remove the nodes marked as jmix:markedForDeletion or jmix:markedForDeletionRoot
The script failed with this exception:

javax.jcr.InvalidItemStateException: Item does not exist anymore: 4bddaf5d-cf26-4abe-90e1-5abe4827cb6e



The issue was in the customer'script


The script has retrieved a list of parents and children of the same path.
The script firstly removed the parent and tried to remove the children.
This was the cause of the exception as the children were already removed with the parent.
The customer has added a try/catch to take care of this exception and the script is now working fine.