Fails if hostKeys is empty.