Originally Posted by
dogfisc
It shouldn't matter if the attack is made by the GM or a player ("shouldn't", heh). What would affect it is they target that is being attacked. That part of the code is checking the type of the target, specifically to see if it is a swarm, as swarms are not subject to flanking. In the case of that error, whatever the target of the attack is doesn't have a "type" in the database.
Unfortunately, I can't reproduce this. I've tried creating a new NPC and intentially not given it a type and it still returns an empty string rather than nil. I'll add some checking to catch this error though. If you can provide any details about what the player was attacking that may help (especially if it was an NPC from one of the PF Bestiaries, since I can look at them myself).
Also, is this error coming up every attack at any target, or just a specific target?