The charge attack of spears has inconsistent hit registration. Even when attacking the same stationary target at sprinting speed, you will occasionally connect your attack but most of the time you will not, despite nothing changing in terms of attacking velocity. Additionally, the hit sound of the charge attack always plays, even when the hit does not register correctly. Note that I am aware of the two block reach deadzone when you’re too close to the target, all of the attacks were done from beyond 2 blocks.
This is because the NoAI entities have velocity but don’t move. You can try /data get entity xxx Motion