[GH-ISSUE #19837] issue: Image creation with Gemini 2.5 Flash Image leads to error "Please use a valid role: user, model" #19013

Closed
opened 2026-04-20 01:18:43 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @Philoso-Fish on GitHub (Dec 9, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/19837

Check Existing Issues

  • I have searched for any existing and/or related issues.
  • I have searched for any existing and/or related discussions.
  • I have also searched in the CLOSED issues AND CLOSED discussions and found no related items (your issue might already be addressed on the development branch!).
  • I am using the latest version of Open WebUI.

Installation Method

Docker

Open WebUI Version

0.6.41

Ollama Version (if applicable)

No response

Operating System

Windows 11

Browser (if applicable)

Chrome

Confirmation

  • I have read and followed all instructions in README.md.
  • I am using the latest version of both Open WebUI and Ollama.
  • I have included the browser console logs.
  • I have included the Docker container logs.
  • I have provided every relevant configuration, setting, and environment variable used in my setup.
  • I have clearly listed every relevant configuration, custom setting, environment variable, and command-line option that influences my setup (such as Docker Compose overrides, .env values, browser settings, authentication configurations, etc).
  • I have documented step-by-step reproduction instructions that are precise, sequential, and leave nothing to interpretation. My steps:
  • Start with the initial platform/version/OS and dependencies used,
  • Specify exact install/launch/configure commands,
  • List URLs visited, user input (incl. example values/emails/passwords if needed),
  • Describe all options and toggles enabled or changed,
  • Include any files or environmental changes,
  • Identify the expected and actual result at each stage,
  • Ensure any reasonably skilled user can follow and hit the same issue.

Expected Behavior

Given a specific prompt, an image should be created.

Actual Behavior

The language model (in this example GPT4o) gives the following output:

"I'm currently unable to generate images due to an error. The error message is: [ERROR: Please use a valid role: user, model.] However, if you need assistance with something else or further information on dogs, feel free to ask!"

Steps to Reproduce

  1. Go to settings -> Images
  2. Turn Image Generation on
  3. Model: gemini-2.5-flash-image
  4. Image Size: 512x512
  5. Image Prompt Generation turned on
  6. Gemini Base URL: https://company_own_base_url.net/v1
  7. Put in correct PI Key
  8. Gemini Endpoint Method: generateContent
  9. Open Chat Interface and turn on the image creation tool
  10. Insert image creation prompt
  11. Receive error message

It is also important to mention that we use a LiteLLM Proxy in the connection settings. All language models (e.g., GPT4o) are provided via LiteLLM. The image model Gemini 2.5 flash image is not provided by LiteLLM.

Logs & Screenshots

The error message is only provided in the answer of the language model and cannot be seen inside the logs of openwebui.
Here are the current settings:

Connections:
Image

Models: (via LiteLLM)
Image

Images:

Image

Additional Information

Base URL and API Key are correct, speaking outside of open webui with the image model works fine.
The issue occurs for all connected models.

Originally created by @Philoso-Fish on GitHub (Dec 9, 2025). Original GitHub issue: https://github.com/open-webui/open-webui/issues/19837 ### Check Existing Issues - [x] I have searched for any existing and/or related issues. - [x] I have searched for any existing and/or related discussions. - [x] I have also searched in the CLOSED issues AND CLOSED discussions and found no related items (your issue might already be addressed on the development branch!). - [x] I am using the latest version of Open WebUI. ### Installation Method Docker ### Open WebUI Version 0.6.41 ### Ollama Version (if applicable) _No response_ ### Operating System Windows 11 ### Browser (if applicable) Chrome ### Confirmation - [x] I have read and followed all instructions in `README.md`. - [x] I am using the latest version of **both** Open WebUI and Ollama. - [x] I have included the browser console logs. - [x] I have included the Docker container logs. - [x] I have **provided every relevant configuration, setting, and environment variable used in my setup.** - [x] I have clearly **listed every relevant configuration, custom setting, environment variable, and command-line option that influences my setup** (such as Docker Compose overrides, .env values, browser settings, authentication configurations, etc). - [x] I have documented **step-by-step reproduction instructions that are precise, sequential, and leave nothing to interpretation**. My steps: - Start with the initial platform/version/OS and dependencies used, - Specify exact install/launch/configure commands, - List URLs visited, user input (incl. example values/emails/passwords if needed), - Describe all options and toggles enabled or changed, - Include any files or environmental changes, - Identify the expected and actual result at each stage, - Ensure any reasonably skilled user can follow and hit the same issue. ### Expected Behavior Given a specific prompt, an image should be created. ### Actual Behavior The language model (in this example GPT4o) gives the following output: "I'm currently unable to generate images due to an error. The error message is: [ERROR: Please use a valid role: user, model.] However, if you need assistance with something else or further information on dogs, feel free to ask!" ### Steps to Reproduce 1. Go to settings -> Images 2. Turn Image Generation on 3. Model: gemini-2.5-flash-image 4. Image Size: 512x512 5. Image Prompt Generation turned on 6. Gemini Base URL: https://company_own_base_url.net/v1 7. Put in correct PI Key 8. Gemini Endpoint Method: generateContent 9. Open Chat Interface and turn on the image creation tool 10. Insert image creation prompt 11. Receive error message It is also important to mention that we use a LiteLLM Proxy in the connection settings. All language models (e.g., GPT4o) are provided via LiteLLM. The image model Gemini 2.5 flash image is not provided by LiteLLM. ### Logs & Screenshots The error message is only provided in the answer of the language model and cannot be seen inside the logs of openwebui. Here are the current settings: Connections: <img width="1564" height="211" alt="Image" src="https://github.com/user-attachments/assets/959d0c7c-103e-4286-aacd-b72dfa96d78b" /> Models: (via LiteLLM) <img width="1571" height="425" alt="Image" src="https://github.com/user-attachments/assets/538ff619-128b-48cb-9018-945385ba4cac" /> Images: <img width="1577" height="373" alt="Image" src="https://github.com/user-attachments/assets/76cffb9f-540a-448d-a3d6-822aff032b02" /> ### Additional Information Base URL and API Key are correct, speaking outside of open webui with the image model works fine. The issue occurs for all connected models.
GiteaMirror added the bug label 2026-04-20 01:18:43 -05:00
Author
Owner

@owui-terminator[bot] commented on GitHub (Dec 9, 2025):

🔍 Similar Issues Found

I found some existing issues that might be related to this one. Please check if any of these are duplicates or contain helpful solutions:

  1. #17626 issue: "Chunk too big" error when using Google Gemini 2.5 Flash with image input
    by BND-1 • Sep 21, 2025 • bug

  2. #19702 issue: Image generation tool causes inconsistency between model response and actual generated image
    by manwallet • Dec 03, 2025 • bug

  3. #19532 issue: using the gemini-3-pro-image-preview model via OpenRouter to generate images, multiple identical images are displayed.
    by liuuuu-pro • Nov 27, 2025 • bug

  4. #15404 issue: Image Generation Fails to Work
    by lie5860 • Jun 30, 2025 • bug

  5. #19425 issue: Can't connect to Gemini in v0.6.38
    by davidpede • Nov 24, 2025 • bug

Show 5 more related issues
  1. #12951 issue: Chunk to big error occurs when using Gemini inline image generation
    by ddddavid-he • Apr 17, 2025 • bug

  2. #14419 issue: Image creation fails in 0.6.11
    by dyioulos • May 27, 2025 • bug

  3. #17466 issue: LLMs such as Gemma3 unable to interpret images
    by batcheej • Sep 15, 2025 • bug

  4. #19518 issue: Duplicate images displayed in gemini-3-pro-image-preview chats
    by davidpede • Nov 26, 2025 • bug

  5. #19451 issue: Images with gpt-image-1 ERROR: No connection adapters were found
    by 3keyallen3 • Nov 25, 2025 • bug


💡 Tips:

  • If this is a duplicate, please consider closing this issue and adding any additional details to the existing one
  • If you found a solution in any of these issues, please share it here to help others

This comment was generated automatically by a bot. Please react with a 👍 if this comment was helpful, or a 👎 if it was not.

<!-- gh-comment-id:3631182799 --> @owui-terminator[bot] commented on GitHub (Dec 9, 2025): 🔍 **Similar Issues Found** I found some existing issues that might be related to this one. Please check if any of these are duplicates or contain helpful solutions: 1. [#17626](https://github.com/open-webui/open-webui/issues/17626) **issue: "Chunk too big" error when using Google Gemini 2.5 Flash with image input** *by BND-1 • Sep 21, 2025 • `bug`* 2. [#19702](https://github.com/open-webui/open-webui/issues/19702) **issue: Image generation tool causes inconsistency between model response and actual generated image** *by manwallet • Dec 03, 2025 • `bug`* 3. [#19532](https://github.com/open-webui/open-webui/issues/19532) **issue: using the gemini-3-pro-image-preview model via OpenRouter to generate images, multiple identical images are displayed.** *by liuuuu-pro • Nov 27, 2025 • `bug`* 4. [#15404](https://github.com/open-webui/open-webui/issues/15404) **issue: Image Generation Fails to Work** *by lie5860 • Jun 30, 2025 • `bug`* 5. [#19425](https://github.com/open-webui/open-webui/issues/19425) **issue: Can't connect to Gemini in v0.6.38** *by davidpede • Nov 24, 2025 • `bug`* <details> <summary>Show 5 more related issues</summary> 6. [#12951](https://github.com/open-webui/open-webui/issues/12951) **issue: Chunk to big error occurs when using Gemini inline image generation** *by ddddavid-he • Apr 17, 2025 • `bug`* 7. [#14419](https://github.com/open-webui/open-webui/issues/14419) **issue: Image creation fails in 0.6.11** *by dyioulos • May 27, 2025 • `bug`* 8. [#17466](https://github.com/open-webui/open-webui/issues/17466) **issue: LLMs such as Gemma3 unable to interpret images** *by batcheej • Sep 15, 2025 • `bug`* 9. [#19518](https://github.com/open-webui/open-webui/issues/19518) **issue: Duplicate images displayed in gemini-3-pro-image-preview chats** *by davidpede • Nov 26, 2025 • `bug`* 10. [#19451](https://github.com/open-webui/open-webui/issues/19451) **issue: Images with gpt-image-1 ERROR: No connection adapters were found** *by 3keyallen3 • Nov 25, 2025 • `bug`* </details> --- 💡 **Tips:** - If this is a duplicate, please consider closing this issue and adding any additional details to the existing one - If you found a solution in any of these issues, please share it here to help others *This comment was generated automatically by a bot.* Please react with a 👍 if this comment was helpful, or a 👎 if it was not.
Author
Owner

@Classic298 commented on GitHub (Dec 9, 2025):

I still have the same issue. I am not sure where the issue actually comes from, if it is improper handling by Open WebUI or a LiteLLM endpoint issue

I'll transfer this to discussions for now because this is a duplicate issue, but yes this needs some investigation where the issue actually comes from. Either the images.py backend or some api endpoint conflict.

<!-- gh-comment-id:3632320374 --> @Classic298 commented on GitHub (Dec 9, 2025): I still have the same issue. I am not sure where the issue actually comes from, if it is improper handling by Open WebUI or a LiteLLM endpoint issue I'll transfer this to discussions for now because this is a duplicate issue, but yes this needs some investigation where the issue actually comes from. Either the images.py backend or some api endpoint conflict.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#19013