Repository navigation
fix(image): surface Gemini safety blocks instead of 'no image data' - #371
Open
pcbeingused333 wants to merge 1 commit into
Open
pcbeingused333 wants to merge 1 commit into
pcbeingused333 wants to merge 1 commit into
Conversation
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
Summary
When Gemini refuses an image prompt, the 200 response has no image part and carries the reason in
promptFeedback.blockReasonorcandidates[].finishReason(IMAGE_SAFETY,PROHIBITED_CONTENT, ...), sometimes with refusal text.generateGeminiImagesignored all of it and always threw the genericGemini returned no image data, so a safety block looked the same as an outage and users retried (and paid for) the same prompt.When no image part is found, the error message is now built from
blockReason(+blockReasonMessage) or the first non-STOPfinishReason(+ refusal text); otherwise it falls back to the old message. No issue was filed; found while readinggenerateGeminiImages.Change risk level
Verification
pnpm typecheckfor affected packages (TypeScript changes)Actually ran:
pnpm --filter ./apps/daemon exec vitest run test/integration/image-generation-api.test.ts: the two new cases (prompt blocked,IMAGE_SAFETYfinish) fail onmasterwith the generic message and pass with this change (22/22).pnpm --filter ./apps/daemon typecheckIntentionally skipped, and why:
Full suite, build and Desktop packaging: the change is local to the Gemini error message in
provider.ts.Web / Desktop parity
Checklist
.runtime/, credentials, Codex sessions, build caches, or user data committedThis change was prepared with an AI coding assistant (Claude Code) and submitted by a human contributor.