Gemini: Response Blocked by Safety Filter

Gemini's safety system evaluates both user input and model output against four harm categories: hate speech, dangerous content, sexual content, and harassment. When the model's generated response scores above the safety threshold for any category, Gemini blocks the response before returning it — even when the user's input was benign. In the API, this manifests as a finish_reason of SAFETY and a None content field, causing response.text to raise an AttributeError.

Is Gemini down right now? Check the live Gemini status page for Google incidents and what to use on Krater meanwhile.

More Gemini error guides