It looks like the code keeps a “count” as it walks through. So it could be a simple logic error. But you should probably do a backup, then a repair to be safe.
None. My tree is small and when I export it, Gramps tells me it contains 412 people, not 413.
That’s a possibility. I have at least one family where I have no father details, as the birth record gives none.
I have more than person in the tree who has married more than once so if this was the problem you would you not expect a difference of greater than one in the two counts?
I’m busy over the weekend so it will be a while before I can do a backup and repair to see if that helps.
I could reproduce the issue and it appears that there indeed is a logic error in the code. However, this defect is seen only if there is a person with repeated ancestors (i.e. there is pedigree collapse). In that case the code “finds” a person via two different routes - this possibility is not taken into account. It also depends on who is selected as the active person.
As a simple example here is a tree where the same person (A4) is a repeated ancestor for A1 (i.e. her parents A2 and B2 are cousins). The selected person is A1.