Haha, i just had the same issue myself, and the problem (at least for me), was that i tried to setup a module to be built in a uncolonizable gravity well using the templates in the galaxy scenario definition file. What i did was try to give the pirates a trade center in the gravity wells they appeared in (not just their home planet), but the game refuses (hardcoded) to allow that to happen, so it results in a crash. Hope that helps.