I had a crash when my bots ghost built a Tiberium Spike, and the code at control.lua line 777 tried to index the surface of the entity, it ended up being a nil and failing. You should probably take steps provide an escape path for if it ends up being invalid when you're doing your thing.