pkgdb(1) is for use with
portupgrade(1). If you are using
portmaster(8) there is no sense in running it. I suggest picking one or the other and sticking with it.
Something probably got corrupted in
/var/db/pkg if it is only happening for certain ports. I have read that this crash could be caused by empty @pkgdep or @name lines. Post the output from the following command:
$ grep -E '^@(pkgdep|name)[[:space:]]*$' /var/db/pkg/*/+CONTENTS