Discord friend asked me for help with this error message:
https://drive.google.com/open?id=1SduY7zUu7mXRMGjkPeOQqro_4KG0IWyO
If it doesn't load, normalEnergyRequired() tried to access the normal difficulty when it didn't exist. Had the person add a nil check. The same error happened again on the line for expensive difficulty.
Referring to the prototype page on wiki, under "Recipe data":
https://wiki.factorio.com/Prototype/Recipe
energy_required is optional. If the recipe exists in the prototype with no energy_required, and no difficulties are defined, this is valid, but the function errors in this case.
Krastorio 2 was added before the start of a game.
Here's a link to a folder with the error image and the enabled mods:
https://drive.google.com/open?id=1TqhjNuPsDPos2q4522oTZ_8D0IxzIKOV
In the function, I don't know why the expensive recipe has a "seconds == 0.5" in front of it (it can't be anything else with how the function is).
My change to the function is here:
https://drive.google.com/open?id=1sHlr6Zo7AIq59uCBoZ3Nj7a8Yi-t3stJ
I also wanted to mention: technically, a difficulty can be nil, which then takes the other difficulty's energy required, but if the difficulty is false, the recipe can't be used in-game until a control effect sets it to enabled. I don't know how this function is used, but it may be relevant to Krastorio2 (should you always take the other energy_required, assuming it will be enabled somehow, or don't use the energy_required because the recipe is disabled at start?)