I know there have been many versions of this, but I think I should add something:
This happens when:
-2 or more villagers are on the same side of the door
-At least 1 villager on each side of the door
-When a bell rings
_When in 1 block thin spaces
Something also unusual, when you have 2 doors facing outwards in a 90-degree angle, villagers cannot sense this and sometimes you have to open the doors for them, causing them to spam for a bit and then walk away, even if something important is in the house like a work station or a bed.
This issue duplicates MC-149060.
If you have any additional information, we would appreciate you adding it to that report. If you have not already, please use the search function to see if your issue has already been reported.