The steps to reproduce are:Index out of Bounds
- Remove/Replace a race (and possibly its references/dependencies)
- add custom race image with naming max_race_image_index+1 (and possibly a transparent _a variant)
- add obligatory troop_XXX images so that there's one group of them for every race (by appending to proper folder like above)
- restructure all race files (add/rearrange races)
This was not properly documented and took a lot of testing to figure out the loading system behind it...
I'm leaving it here so that I can find it the next year again!

The docs only said about padding the ship images and flags etc, but nothing about race images forced use.