Why do my villagers run towards zombies
I have a villager trading hall which uses the ai of villagers to move them along. A zombie will make them run until they fall into a hole. I finished the project and threw a villager in there, and it ran towards the zombie and died. So did all of the other attempts. I can’t figure out why.
Solution 1:
Villagers always attempt to get back to their village once they get too far away. My guess is that you transported the villager away from the village and that it is now trying to get back there by itself and thus run into the arms of the zombie.
In order to solve this, you should either build your village on the other side of the contraption, causing the villager to run towards the correct side instead, or move the village even further away, so that the villager can't "see" it anymore. Another option would be to not rely on AI, but then you'd need to rebuild your entire setup, which might not be desirable.
EDIT:
Using your description, I performed my own test. This is what it looks like:
As you can see, all the villagers ran away from the zombie as expected. Next I built a village a few blocks behind the zombie, to "lure" the villagers towards the zombie:
As you can see, all the villagers are now moving towards the zombie instead, trying to get to the village.