I have had villagers in my world for over a month now, with them named, traded to complete mastery, in minecarts, covered completely in glass just disappear. As far as I know, this should not be able to happen.
Assuming this was simply bad luck and somehow a zombie infected all of them then they despawned I took the world files and entered it in creative where I did as many tests as possible with zombies, drowned, phantoms, pillagers, etc and found no instance where a outside mob would be able to damage the villagers much less infect them. There was no environmental damage around the villagers so I was able to rule out a freak creeper explosion.
This also happened with a villager trapped within a potato farm in the same area that I was using as a villager breeder, the area was lit above light level 8, villager name tagged, no way a mob got in, etc.
I only noticed this issue occurred after a flight to a forest a couple thousand blocks away, I would hypothesize that the game had an issue while auto saving and the entities were not processed. I was not able to duplicate this result in my testing but I have not checked all the source code to find a possible issue.
Duplicate of #MC-153904