That's peculiar, I've got the same error and it seems to be the for loop but I'm not sure why that is. The error doesn't happen with a while loop.
while count < allMonsters.size():
if spawnNode.distance_to(allMonsters[count].get_global_pos()) < desiredDistance:
#find another location
count += 1
#Reset the count int
count = 0
also if distance_to
causes an error try spawnNode.transform.origin.distance_to...
EDIT: I completely missed that it needs .size()
for count in allMonsters.size():