Know that there have been some historical issues with some operations that when executed within a for-each, sometimes the context of the for-each goes awry.
Recall there was a longstanding bug related to this. Cannot find it referenced off hand, but see that maybe it returned or was related to this 4.8.2 fix.
Ability to Run the Extensive do-for-each Loop Successfully#
Identity Engine is enhanced to process the extensive do-for-each loop on server without any contexts.
Anyone have history/personal experience with this scenario? Seem to recall it was when one used some query tokens within the for-each loop.