Process blocked responses

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:

  • ThepromptFeedbackfield is populated. This field contains information about why theprompt is blocked.
  • Thecandidatesfield 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:

You can determine why the content was blocked by inspecting these fields in theAPI response.

What's next

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.