[GH-ISSUE #23611] bug: Image generation fails with providers that don't support 'size' parameter (e.g., xAI/grok-imagine-image) #74629

Closed
opened 2026-05-13 07:26:50 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @agent2x0r on GitHub (Apr 12, 2026).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/23611

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

v0.8.12

Ollama Version (if applicable)

No response

Operating System

Debian 12

Browser (if applicable)

No response

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

Image generation should work with providers that don't support the size parameter, or the size parameter should be optional.

Actual Behavior

OpenWebUI always sends the size parameter (either user-provided value or default), causing xAI to reject the request with "Argument not supported: size".

Steps to Reproduce

  1. Set up the OpenWebUI image generation provider to use xAI
  2. Set grok-imagine-image as the model
  3. Clear out the "size" field (or set it to any value)
  4. Open a new chat and select a chat model and Toggle "on" Image integration
  5. Enter a prompt and try to generate an image
  6. Error appears in chat output UI and logs: "Argument not supported: size".

Logs & Screenshots

Apr 12 03:26:52 litellm litellm[40868]: litellm.proxy.proxy_server.image_generation(): Exception occured - litellm.BadRequestError: XaiException - Error code: 400 - {'code': '400', 'error': 'Argument not supported: size'}. Received Model Group=grok-imagine-image
Apr 12 03:26:52 litellm litellm[40868]: Available Model Group Fallbacks=None
Apr 12 03:26:52 litellm litellm[40868]: INFO: 192.168.0.221:38886 - "POST /images/generations HTTP/1.1" 400 Bad Request

Additional Information

Root Cause

In backend/open_webui/routers/images.py, line 555:

'size': (form_data.size if form_data.size else request.app.state.config.IMAGE_SIZE),

This always sends size parameter (either user's value or default config value), even when the provider doesn't support it.

Same issue at line 863 for image edit endpoint.

Temporary Fix allowed for successful image generation with xAI provider

Only send size when user actually provides one:

**({'size': form_data.size} if form_data.size else {}),
Originally created by @agent2x0r on GitHub (Apr 12, 2026). Original GitHub issue: https://github.com/open-webui/open-webui/issues/23611 ### 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 v0.8.12 ### Ollama Version (if applicable) _No response_ ### Operating System Debian 12 ### Browser (if applicable) _No response_ ### 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 Image generation should work with providers that don't support the `size` parameter, or the `size` parameter should be optional. ### Actual Behavior OpenWebUI always sends the `size` parameter (either user-provided value or default), causing xAI to reject the request with "Argument not supported: size". ### Steps to Reproduce 1. Set up the OpenWebUI image generation provider to use xAI 2. Set grok-imagine-image as the model 3. Clear out the "size" field (or set it to any value) 4. Open a new chat and select a chat model and Toggle "on" Image integration 5. Enter a prompt and try to generate an image 7. Error appears in chat output UI and logs: "Argument not supported: size". ### Logs & Screenshots Apr 12 03:26:52 litellm litellm[40868]: litellm.proxy.proxy_server.image_generation(): Exception occured - litellm.BadRequestError: XaiException - Error code: 400 - {'code': '400', 'error': 'Argument not supported: size'}. Received Model Group=grok-imagine-image Apr 12 03:26:52 litellm litellm[40868]: Available Model Group Fallbacks=None Apr 12 03:26:52 litellm litellm[40868]: INFO: 192.168.0.221:38886 - "POST /images/generations HTTP/1.1" 400 Bad Request ### Additional Information ## Root Cause In `backend/open_webui/routers/images.py`, line 555: ```python 'size': (form_data.size if form_data.size else request.app.state.config.IMAGE_SIZE), ``` This always sends `size` parameter (either user's value or default config value), even when the provider doesn't support it. Same issue at line 863 for image edit endpoint. ## Temporary Fix allowed for successful image generation with xAI provider Only send `size` when user actually provides one: ```python **({'size': form_data.size} if form_data.size else {}), ```
GiteaMirror added the bug label 2026-05-13 07:26:50 -05:00
Author
Owner

@tjbck commented on GitHub (Apr 13, 2026):

Addressed in dev.

<!-- gh-comment-id:4239129959 --> @tjbck commented on GitHub (Apr 13, 2026): Addressed in dev.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#74629