Skip to content

fix(storage-resize-images): a malformed model reply to CUSTOM_FILTER_PROMPT blocks the image (existing extension bug, also in the kit) #3269

Open

Description

@IzaakGough

Existing bug in the storage-resize-images extension (0.3.6), carried over to the kit. It is not a kit/extension parity difference, so it is not tracked under #3263. Priority: medium. With CUSTOM_FILTER_PROMPT set, an image that should pass can be replaced by the placeholder, and the log blames the safety filters.

Problem

When the model's reply fails genkit's output schema check (must have required property 'response'), the code treats it as a block. One malformed reply turns a "no" into a placeholder, and the log says Image content blocked by Vertex AI content filters., which points the user at CONTENT_FILTER_LEVEL rather than the prompt. By reading, with DELETE_ORIGINAL_FILE=true a blocked image counts as a success, so the original is also deleted (not run).

Reproduced

CONTENT_FILTER_LEVEL=BLOCK_MEDIUM_AND_ABOVE, CUSTOM_FILTER_PROMPT="Does this image contain a cat?" and a custom placeholder. An image with no cat was uploaded three times to each side:

  • Kit: placeholder in 2 of 3 runs.
  • Extension: resized in 3 of 3 runs.

Direct calls with the extension's genkit version reproduced the schema failure on some replies. The moderation code is the same on both sides (by reading), so the split is put down to model nondeterminism.

Code

Resolution

With a custom prompt, treat a schema failure as a retryable error rather than a block, and log a message that names the custom prompt. Keep the safety-filter block (finishReason: "blocked") as it is.

Activity

  1. changed the title [-]fix(storage-resize-images): a malformed model reply to CUSTOM_FILTER_PROMPT blocks the image (extension and kit)[/-] [+]fix(storage-resize-images): a malformed model reply to CUSTOM_FILTER_PROMPT blocks the image (existing extension bug, also in the kit)[/+] on Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions