When deleting one patron (members/deletemem.pl), Koha checks that patron is not a guarantor, else it does not allow deletion. But in tools > batch patron deletion (tools/borrowers.pl or misc/cronjobs/delete_patrons.pl), this check is not performed, so there is a lot of borrowers with guarantorid that does not exist any more. Check if patron is a guarantor should be performed in all cases of deletion.
It seems that check is done in GetBorrowersToExpunge function So I don't understand why there is so many borrowers with unknown guarantorid in our databases