You need to fix your service and have every ID match their index.
I was told that top:5 may actually be accessing ID=6, that's why it worked and top:6 is trying to access ID=7, which is already out of bound... as caused by the broken layer (ID=1).
ID=1 may be missing because it was not published but is still contained in your ArcMap Table of Contents. You can either delete layer with ID=1 from ToC or include it and re-publish.