Thank you for reporting this. I believe this issue is already solved in the new unreleased version 1.13, wich I will be releasing soon.
Viewing post in NPC Generator for 5e - Foundry VTT Module comments
What job, race and CR were you trying to build? It failed only this once, or everytime you try to build a similar NPC? Creating spellcasters seems ok in general?
Im having really trouble reproducing this error, could it be your compendiums are somehow alterated? This bug could be caused in case its failing to get the spells from your compendiums.