We use the Gemini API for production e-commerce garment photography (children’s clothing flat-lay images). We’re hitting three issues that are blocking our pipeline.
Setup:
- SDK: google-genai (new Python SDK)
- Models: gemini-3.1-flash-image-preview and gemini-3-flash-preview
- Config: response_modalities=[‘TEXT’, ‘IMAGE’], temperature=0.0, candidate_count=1
- ImageConfig: image_size=“4K”, aspect_ratio=“1:1”
- Input: text prompt + 1-2 reference images (garment photo + mask silhouette)
-–
Issue 1: Repeating edge artifacts on dark garments
When cleaning up dark-colored garments (black shorts, navy tops), the model adds repeating bump/scallop/zigzag patterns along the garment edges that do not exist in the source image. These appear as evenly-spaced notches or wave patterns running along the hem, side seams, and leg openings.
We have tried explicit prompt instructions (“Do NOT add any repeating bumps, scallops, wavy patterns, serged-edge textures along the edges”) but the model ignores them completely. The artifact persists across multiple retries with the same prompt.
-–
Issue 2: White box/rectangle on white garments
When processing white t-shirts, the model sometimes renders a visible rectangular patch in the middle of the fabric. The garment is white and the background is pure white The model appears to hallucinate a faint box shape on the fabric surface that does not exist in the source. This makes the output unusable.
Issue 3: IMAGE_OTHER — silent failure with no diagnostics
Roughly 10-20% of requests return HTTP 200 with finish_reason: IMAGE_OTHER but zero image parts. The response contains:
- candidates[0].content.parts: empty or text-only
- prompt_feedback: None
- safety_ratings: None
- block_reason: None
- finish_message: None
There is no information explaining why the image was not generated. The exact same prompt and image will succeed on retry, suggesting a transient issue. We have retry logic for HTTP errors (500, 502, 503, 429) but IMAGE_OTHER returns as a 200 OK with no usable output and no explanation.
We need a way to get a meaningful failure reason when this happens.
-–
Questions:
1. Are the repeating edge artifacts a known model behavior? Any mitigation guidance?
2. What does finish_reason IMAGE_OTHER mean internally? Can we get sub-reasons?
3. Is gemini-3.1-flash-image-preview stable for production image generation?
4. Is there a recommended model or config to reduce these issues?
Any help appreciated. Happy to provide API key, project ID, or specific request timestamps for investigation.
