Hmmmmm, Do you mean after the error it continues trying to get the same sequence? It's in a for loop so should only try each one the entries once unless they appear multiple times in the array "@entries".
Forgot to change this when I wrote the code but the for loop should be: