Can't remove item from index

may not be the cause, but just for better understanding:

what exactly do you mean with “during the for loop”?

There’s a return node at the end of the loop body, so it seems it won’t do any further loop run after remove_index.