When interacting with Gemini on Vertex AI, your requests
(prompts) or the generated responses might be blocked by content filters. This
document provides guidance on how to identify and process these blocked
responses. There are two scenarios for content filters blocking content: The sections that follow describe how to process each scenario. If your input prompt is blocked by content filters before it is sent to the
model, the API response exhibits the following characteristics: If the model generates a response but that response is blocked by content
filters, the API response exhibits the following characteristics: You can determine why the content was blocked by inspecting these fields in the
API response.When is content blocked?
The input prompt is blocked
promptFeedback
field is populated. This field contains information about why the
prompt is blocked.candidates
field isn't set.The model's response is blocked
promptFeedback
field isn't set.candidates
field is set with the following characteristics:
content
field isn't set.finishReason
field is set and indicates why response generation stopped.What's next
Process blocked responses
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-21 UTC.