ON statement out of range (ERR=58) The index value in an ON GOTO or ON GOSUB statement is less than 1 or greater than the number of line numbers in the list. Check program logic to make sure that the index value is greater than or equal to one, and less than or equal to the number of line numbers in the ON GOTO or ON GOSUB statement.