Feeder ocassionally is empty

I have created a feeder that creates objects after pulling data from a JSON file.

public class FruitFeeder{
	public static Iterator<Map<String, Object>> CreateFeeder() {
		Gson gson = new Gson();
		try (InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream("data/Fruit.json")) {
			if (in == null) {
				throw new RuntimeException("InputStream is null, maybe couldn't find the Fruit.json file");
			}

			String jsonString = new BufferedReader(new InputStreamReader(in)).lines().collect(Collectors.joining("\n"));
			Fruit[] fruits = gson.fromJson(jsonString, Fruit[].class);

			return Stream.generate((Supplier<Map<String, Object>>) () -> {
				ArrayList<Map<String,Object>> fruitList = new ArrayList<>();

				for (Fruit fruit: fruits) {

                    int randomSize = ThreadLocalRandom.current().nextInt(0, 500);

					// Create a fruit map
					Map<String, Object> fruitMap = Map.of(
							"name", fruit.name,
							"color", fruit.color,
                            "size", randomSize);

					//Add to array
					fruitList.add(fruitMap)
				}

				return Map.of("fruits", fruitList);
			}).iterator();
		} catch (IOException e) {
			throw new RuntimeException(e);
		}
	}
}

When using this feeder in a ChainBuilder it sometimes works. Sometimes I am given the error Feeder is now empty, stopping the engine.

Currently the simulations that depend on this feeder only inject 1 user. My intention is that this feeder creates a new array of fruit mappings everytime it is called. It creates the maps by a combination of data it pulls from JSON and data it randomly generates.

What am I missing?

Please provide a full reproducer as requested here. For example a full working maven project pushed on GitHub.
As is, there’s too much work to add all the missing pieces and too many unknown parts (project configuration, how you’re using this feeder, your JSON file, etc).

Also, please make sure to use Gatling 3.8.3.

In creating an example project I uncovered an error in my code that caused an access exception.
In my code, a random index was chosen by,
int randomIndex = ThreadLocalRandom.current().nextInt(0, myArray.length + 1)
The issue revolved around +1, because using creating a random index on myArray with length of 6, could possibly create a randomIndex with 7, which is not within myArray’s bounds.