Use "For Each Item (Break)" for nested and repeating loops with parallel splitting
I would like to share this suggestion because I know from my own experience that it could take a long time to discover where is the problem.
Tip concerns making nested or repeating loops used for parallel splitting.
Usually for parallel splitting is used For Each Element in Collection component. But you must know that its logic is based on hidden variable called IteratorPrefix_<GUID> passed along the next element path and it is removed only on finished path. So both parallel paths (this with Task 1 also) gets this variable. After finishing all parallel tasks Wait For Specified Workflow Components In Model component will allow to continue the process and iterator variable will be passed back to the same For Each Element in Collection component! Because for component it means that should continue the previous loop, it won't start the new loop! What more, when the index will be out of the range the exception will be thrown.
This is because of creating unintentionally two For each loops: one short directly through splitting component and second through tasks and Wait component. Logically the second one shouldn't be treated as a loop so each parallel branch must be broken using For Each Item (Break) that removes iterator variable of specified For Each component.
So my advice is: always place the For Each Item (Break) component on paths coming out from next element output that shouldn't be treated as loop of For Each component.
I attached simple model for illustration.