Something strange with slingers/javelinists behavior. I can't be more precise... sometimes they fire normally when ordered to, sometimes they run to melee range without throwing anything, sometimes they fire one time then go to melee. And it's not because they are engaged : I've seen several times after a volley a full squad of slingers moving from a normal range to melee without reason. I think slingers/javelinists become buggy when an unit unable to fire is mixed with them, or when one is wounded and can't use his weapon (but it looks like it's not systematic).
(see
this thread )
Another bug or perhaps they are just too stupid :
archers and slingers without a commander outside the province defense one (units in garnison or recruited this turn) attack in melee instead of using their ranged weapons.