This comes from trying to access an index that doesn't exist in the array. For instance, if you have an array of 5 elements, the valid indexes are 0 through 4. If you attempt to access index -1 or index 5, then you'll see this error because you're probably overstepping the bounds of the array.
This often happens in for loops or while loops where the terminating condition is incorrect. Verify that your loop starts at a valid index and ends at a valid index.