Minecraft wiki entry for Villager, associated text: Villagers flee from zombies, zombie villagers, husks, drowned, zombified piglins ‌[Bedrock Edition only], zoglins, vindicators, pillagers (even if their crossbow has been broken), ravagers, and vexes within 8 blocks, and evokers and illusioners within 12 blocks. Like other passive mobs, villagers sprint away when attacked. Villagers do not run away from skeletons (and their variants), spiders, or cave spiders since these hostile mobs are passive towards villagers, although a skeleton arrow might hit a villager by accident.