When running a script to process page items stored in a custom array and after moving a page item to another layer, the array contents changes. Objects are removed and other objects which where not put in the array are suddenly located inside the array.
See also: https://forums.adobe.com/thread/2438907
Uwe Laubender commented
This problem is resolved now. No bug.
It's collection vs array, unresolved items vs resolved items with everyItem().getElements().