It’s because I forgot to break;
out of a backwards loop after shortening the array:
Hitting this depends on a bitmap load pending for I suspect at least two frames right before another change, which explains why this was inconsistent and how the tile changer could provoke it (by generating unrelated “network” load or by causing the game to update multiple times in a row to catch up with a short freeze).
I’ll include the fix alongside the target groups later today.
Edit: The fix and target groups are included starting in Ver. 1.3.2-RC.4, which is now online.