It happens if you hold e on the npc for to long, or double click E really fast.
Not sure why it still happens tho, there is a delay on 0.3 seconds, and once the menu is open, the "e" click will not register on the npc because the menu is kinda like in the way.