this might sound silly, but I was having this same problem yesterday, and just now found that the key bind for “target nearest NPC or object” was unassigned, when it should be NUM0
and NUM0 is assigned to something else now, although still works as target npc when i press it manually =p
but any way, assigning “target nearest NPC or object” with a key has fixed the issue for me, just thought I’d share