[API Nodes] Gemini: raise exception when no candidates due to safety block#11848
Merged
Kosinkadink merged 1 commit intomasterfrom Jan 13, 2026
Merged
[API Nodes] Gemini: raise exception when no candidates due to safety block#11848Kosinkadink merged 1 commit intomasterfrom
Kosinkadink merged 1 commit intomasterfrom
Conversation
Kosinkadink
approved these changes
Jan 13, 2026
Contributor
|
Might be worthwhile to include the regular PROHIBITED_CONTENT which is for text based queries (IMAGE_PROHIBITED_CONTENT only covers image generative requests iirc), overload and unknown as UNKNOWN. I have such handling in my custom node here since the text detector model they use tends to flag things out of context or even completely nonsensical stuff: https://github.com/silveroxides/ComfyUI_Gemini_Expanded_API/blob/35844f7f9f334bc97f2c5bf4b7d9e38d4518ebed/gemini_nodes.py#L642 |
Contributor
Author
|
@silveroxides, do you have any prompts I can use to check for So, to avoid breaking anything and adding untested code, I decided to only include what I can test. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Improves error handling for Gemini image generation when safety filters block content.
This will handle the situation where you ask to generate image with prompt "sexy naked girl" and an empty image is returned.
In this case, it's more appropriate to throw an exception so that other parts of workflow that are waiting for an image don't work with a blank image(which is not expected).
API Node PR Checklist
Scope
Pricing & Billing
If Need pricing update:
QA
Comms