Generative AI Leader Google Cloud's Generative AI Offerings Practice Question
An engineer is testing a generative AI application using the Gemini API. They receive a 400 error with message 'INVALID_ARGUMENT: text has been blocked.' What is the most likely cause?
⚠ Common exam trap
In Google Cloud's Gemini API, a 400 'INVALID_ARGUMENT: text has been blocked' error indicates that the input was rejected by safety filters before processing. Candidates often confuse this with authentication (invalid API key) or quota errors, which return different error codes (e.g., 403 or 429). Understanding the specific error message and its association with Gemini's safety settings is key.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
The input text was flagged by a safety filter
The 400 error with 'INVALID_ARGUMENT: text has been blocked' indicates that the input text was rejected by Gemini's safety filters before any model processing occurred. These filters evaluate content against categories like hate speech, harassment, or sexually explicit material, and when triggered, they block the request at the API gateway level, returning this specific error message.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
The specified Gemini model version does not exist
Why it's wrong here
A nonexistent model returns 404 NOT_FOUND naming the model, not a 400 citing blocked text. The message indicates the safety classifier rejected the content itself. Selecting a valid model version is the correct action when the endpoint or model name is wrong, not when input triggers a content filter.
- ✓
The input text was flagged by a safety filter
Why this is correct
A 400 INVALID_ARGUMENT with 'text has been blocked' indicates the request content tripped Gemini's safety filters, which screen prompts and responses for harmful categories. The input was rejected before generation, so no model output was produced.
- ✗
The API key is invalid
Why it's wrong here
A 400 INVALID_ARGUMENT with 'text has been blocked' means the prompt or response tripped a safety filter, so the request never reached authentication. An invalid API key returns 401 UNAUTHENTICATED instead. Key rotation is the right fix when credentials are revoked or malformed, not when content is filtered.
- ✗
The API quota has been exceeded
Why it's wrong here
Exceeded quota returns 429 RESOURCE_EXHAUSTED with retry guidance, not 400 INVALID_ARGUMENT. The blocked-text wording points to a safety filter rejecting the prompt or response. Requesting a quota increase is correct when rate limits are hit, not when content is filtered.
Go deeper
Related to this question
About these practice questions
This Generative AI Leader question is part of Courseiva's 1,008-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This Generative AI Leader practice question is part of Courseiva's free Google Cloud certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the Generative AI Leader exam.