Process blocked responses Stay organized with collections Save and categorize content based on your preferences.
When interacting with Gemini on Vertex AI, your requests(prompts) or the generated responses might be blocked by content filters. Thisdocument provides guidance on how to identify and process these blockedresponses.
When is content blocked?
There are two scenarios for content filters blocking content:
- The input prompt is blocked.
- The model's response is blocked.
The sections that follow describe how to process each scenario.
The input prompt is blocked
If your input prompt is blocked by content filters before it is sent to themodel, the API response exhibits the following characteristics:
- The
promptFeedbackfield is populated. This field contains information about why theprompt is blocked. - The
candidatesfield isn't set.
The model's response is blocked
If the model generates a response but that response is blocked by contentfilters, the API response exhibits the following characteristics:
- The
promptFeedbackfield isn't set. - The
candidatesfield is set with the following characteristics:- The
contentfield isn't set. - The
finishReasonfield is set and indicates why response generation stopped.
- The
You can determine why the content was blocked by inspecting these fields in theAPI response.
What's next
- Learn how toconfigure content filters.
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2026-02-19 UTC.