I think the issue you are facing is due to the latest updates of Face API product, which is detailed in this blog post.
In a few words, some features have been disabled.
In particular:
In another change, we will retire facial analysis capabilities that
purport to infer emotional states and identity attributes such as
gender, age, smile, facial hair, hair, and makeup. We collaborated
with internal and external researchers to understand the limitations
and potential benefits of this technology and navigate the tradeoffs.
In the case of emotion classification specifically, these efforts
raised important questions about privacy, the lack of consensus on a
definition of “emotions,” and the inability to generalize the linkage
between facial expression and emotional state across use cases,
regions, and demographics. API access to capabilities that predict
sensitive attributes also opens up a wide range of ways they can be
misused—including subjecting people to stereotyping, discrimination,
or unfair denial of services.
To mitigate these risks, we have opted to not support a
general-purpose system in the Face API that purports to infer
emotional states, gender, age, smile, facial hair, hair, and makeup.
Detection of these attributes will no longer be available to new
customers beginning June 21, 2022, and existing customers have until
June 30, 2023, to discontinue use of these attributes before they are
retired.
In your code, you are asking for some of these attributes (gender & age) so you should remove those attributes and try again.