Today I had one these very old bugs that been happening randomly to people since 2011 in an old post. My single target attacks like demons’s bite and chaos strike wouldn’t work kept saying invalid target… I had to exit client and reopen to get it to work again. How long does this bug need to stay in game before this is ever fixed.
The game thinks that your alt key is being held down, which by default makes all abilities self-target you, thus giving you an invalid target error for any offensive skill.
This may or may not happen when alt-tabbing, and may not actually be a bug in WoW at all, it could be an OS issue.
Anyways, the fix is actually quite simple, closing and reopening the client is not necessary. All you need to do is press your alt key(s) once or twice to resync the actual state of the key.
Alternatively, you can also change/disable the auto-selfcast setting in the interface settings menu. This will prevent the invalid target errors, however it will not prevent the game from sometimes thinking that your alt-key is being held, which can effect any keybinds or macros that use alt (but again, the fix when it happens is to simply press your alt key a couple times).