The bug
If an invisible player attack a piglin that has a crossbow, they will pathfind toward the invisible player. But the crossbow-wielding piglin would get stuck in a loop of charging their crossbows while backing off and going back towards the invisible player.
To reproduce
In the nether run:
/summon piglin ~ ~ ~ {HandItems:[{id:crossbow,Count:1b}]}
Drink an invisibility potion
Attack it once
β β It runs towards you, backing off while loading its own crossbow, stops loading, and repeats this behavior.
Relates toΒ MC-177973