Where are you getting this list of candidate validators from?
hasKey query is for checking if a node contains a specific session key. That is, you would not pass an account ID or address to it. I see that you are connected to
localhost. Is this actually a validator with keys?
If you want to check if your local node is a validator, you can look up the
nextKeys for the address you're interested in, and then call
api.rpc.author.hasSessionKeys(<keys>) for the concatenation of all the keys. If it returns
true, then that node has the session keys for that validator.
Note that this does not guarantee that you are safe from equivocation, i.e. that another node does not have the keys as well. Only that this node does have the keys.
EDIT: Here is a more complete example:
First, I'll check if the stash I'm interested in has signaled intent to be a validator with
It is, so let's look up its session keys with
Now, I SSH into the node that I know is using those keys. Of course, you need RPC access to whatever node you want to check the keys on. To make the storage key, I concatenate all of the keys into one value:
author.hasSessionKeys(<long hex value>), I get
If I just want to check one, I can do so with
session.hasKey(<key>, <type>). In this case I'll use
babe, so the key is