[GH-ISSUE #20158] issue: [with Fixes] Duplicate / Multiple Images displayed in Chat from a complex ComfyUI workflows #57774

Closed
opened 2026-05-05 21:35:12 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @marhensa on GitHub (Dec 24, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/20158

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.6.43

Ollama Version (if applicable)

No response

Operating System

Fedora 43

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

When using complex ComfyUI workflows in Open WebUI, the chat interface often displays multiple duplicate images (it's the same images, bunch of them, it's from nodes like masks, crops, or segmentation previews) instead of just the final result.

Even if a user only includes a single SaveImage or PreviewImage node, Open WebUI's current implementation retrieves every possible image in the workflow's execution history. This results in a cluttered chat experience where internal processing steps are shown as final outputs.

Proposed Solution / Expected Behaviour:
The get_images function in backend/open_webui/utils/images/comfyui.py should be updated to explicitly filter for nodes defined as output nodes. By checking the class_type of each node in the workflow against the history outputs, we can ensure that only images intended for the user are retrieved.

Additionally, the current implementation contains a redundant nested loop that iterates through the history outputs twice, which is addressed in the fix below.

File affected: backend/open_webui/utils/images/comfyui.py

Suggested Changes:

Before:

    history = get_history(prompt_id, base_url, api_key)[prompt_id]
    for o in history["outputs"]:
        for node_id in history["outputs"]:
            node_output = history["outputs"][node_id]
            if "images" in node_output:
                for image in node_output["images"]:
                    url = get_image_url(
                        image["filename"], image["subfolder"], image["type"], base_url
                    )
                    output_images.append({"url": url})
    return {"data": output_images}

After:

    history = get_history(prompt_id, base_url, api_key)[prompt_id]
    for node_id in history["outputs"]:
        node_output = history["outputs"][node_id]
        if node_id in prompt and prompt[node_id].get("class_type") in ["SaveImage", "PreviewImage"]:
            if "images" in node_output:
                for image in node_output["images"]:
                    url = get_image_url(
                        image["filename"], image["subfolder"], image["type"], base_url
                    )
                    output_images.append({"url": url})
    return {"data": output_images}

This change ensures that only nodes with the class_type of SaveImage or PreviewImage are returned to the chat, effectively filtering out intermediate "IMAGE" outputs from nodes like MaskToImage, CutByMask, or FaceSegmentation, etc.

Actual Behavior

Even if a user only includes a single Save Image or Preview Image node, Open WebUI's current implementation retrieves every possible image in the workflow's execution history. This results in a cluttered chat experience where internal processing steps are shown as final outputs.

Steps to Reproduce

  1. Have some ComfyUI workflow that have a node that have image output on it (even this image output is not pointed to any preview/save node), like Cut by Mask, Convert Mask to Image, Paste Image by Mask, etc.
  2. If your workflow has 4 nodes that have image output (remember, it's NOT connected into any preview/save node) and 1 actual node as output (preview / save node), it will give us 5 images in total, not 1.

Logs & Screenshots

[open-webui] | 2025-12-24 13:34:49.212 | INFO     | open_webui.utils.images.comfyui:queue_prompt:20 - queue_prompt

[open-webui] | 2025-12-24 13:35:12.122 | INFO     | open_webui.utils.images.comfyui:get_history:57 - get_history

[open-webui] | 2025-12-24 13:35:12.131 | INFO     | open_webui.utils.images.comfyui:get_image_url:50 - get_image

[open-webui] | 2025-12-24 13:35:12.131 | INFO     | open_webui.utils.images.comfyui:get_image_url:50 - get_image

[open-webui] | 2025-12-24 13:35:12.131 | INFO     | open_webui.utils.images.comfyui:get_image_url:50 - get_image

[open-webui] | 2025-12-24 13:35:12.131 | INFO     | open_webui.utils.images.comfyui:get_image_url:50 - get_image

[open-webui] | 2025-12-24 13:35:12.131 | INFO     | open_webui.utils.images.comfyui:get_image_url:50 - get_image

[open-webui] | 2025-12-24 13:35:12.140 | INFO     | open_webui.routers.files:upload_file_handler:185 - file.content_type: image/png False

[open-webui] | 2025-12-24 13:35:12.583 | INFO     | open_webui.routers.files:upload_file_handler:185 - file.content_type: image/png False

[open-webui] | 2025-12-24 13:35:12.606 | INFO     | open_webui.routers.files:upload_file_handler:185 - file.content_type: image/png False

[open-webui] | 2025-12-24 13:35:13.040 | INFO     | open_webui.routers.files:upload_file_handler:185 - file.content_type: image/png False

[open-webui] | 2025-12-24 13:35:13.305 | INFO     | open_webui.routers.files:upload_file_handler:185 - file.content_type: image/png False

[open-webui] | 2025-12-24 13:35:13.326 | INFO     | uvicorn.protocols.http.httptools_impl:send:476 - 10.100.0.2:36594 - "POST /api/v1/images/generations HTTP/1.1" 200

[open-webui] | 2025-12-24 13:35:13.422 | INFO     | uvicorn.protocols.http.httptools_impl:send:476 - 10.100.0.2:36594 - "GET /api/v1/files/144d9dbd-1ab9-4e1d-b97f-e147576a3c73/content HTTP/1.1" 200

[open-webui] | 2025-12-24 13:35:13.423 | INFO     | uvicorn.protocols.http.httptools_impl:send:476 - 10.100.0.2:36046 - "GET /api/v1/files/75e21195-c61d-4f64-87f3-2f24eb9d7a1b/content HTTP/1.1" 200

[open-webui] | 2025-12-24 13:35:13.423 | INFO     | uvicorn.protocols.http.httptools_impl:send:476 - 10.100.0.2:36036 - "GET /api/v1/files/19833916-9adb-4c29-8baf-38f13a213f17/content HTTP/1.1" 200

[open-webui] | 2025-12-24 13:35:13.424 | INFO     | uvicorn.protocols.http.httptools_impl:send:476 - 10.100.0.2:36050 - "GET /api/v1/files/fa5c8db5-4c83-4a83-885b-2ca169c26cf6/content HTTP/1.1" 200

[open-webui] | 2025-12-24 13:35:13.424 | INFO     | uvicorn.protocols.http.httptools_impl:send:476 - 10.100.0.2:36054 - "GET /api/v1/files/9e460cd1-3b87-4064-b5ee-67908bcc1d55/content HTTP/1.1" 200

[open-webui] | 2025-12-24 13:35:13.509 | INFO     | uvicorn.protocols.http.httptools_impl:send:476 - 10.100.0.2:36060 - "POST /api/v1/chats/86481ff8-b175-4df8-b614-385c9dce4243 HTTP/1.1" 200

[open-webui] | 2025-12-24 13:35:13.526 | INFO     | uvicorn.protocols.http.httptools_impl:send:476 - 10.100.0.2:36060 - "GET /api/v1/chats/?page=1 HTTP/1.1" 200

It gives us 5 duplicate images instead of just 1 final result from "Preview Image" or "Save Image".

Additional Information

No response

Originally created by @marhensa on GitHub (Dec 24, 2025). Original GitHub issue: https://github.com/open-webui/open-webui/issues/20158 ### 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.6.43 ### Ollama Version (if applicable) _No response_ ### Operating System Fedora 43 ### 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 When using complex ComfyUI workflows in Open WebUI, the chat interface often displays multiple duplicate images (it's the same images, bunch of them, it's from nodes like masks, crops, or segmentation previews) instead of just the final result. Even if a user only includes a single `SaveImage` or `PreviewImage` node, Open WebUI's current implementation retrieves every possible image in the workflow's execution history. This results in a cluttered chat experience where internal processing steps are shown as final outputs. **Proposed Solution / Expected Behaviour:** The `get_images` function in `backend/open_webui/utils/images/comfyui.py` should be updated to explicitly filter for nodes defined as output nodes. By checking the `class_type` of each node in the workflow against the history outputs, we can ensure that only images intended for the user are retrieved. Additionally, the current implementation contains a redundant nested loop that iterates through the history outputs twice, which is addressed in the fix below. **File affected:** `backend/open_webui/utils/images/comfyui.py` **Suggested Changes:** **Before:** ```python history = get_history(prompt_id, base_url, api_key)[prompt_id] for o in history["outputs"]: for node_id in history["outputs"]: node_output = history["outputs"][node_id] if "images" in node_output: for image in node_output["images"]: url = get_image_url( image["filename"], image["subfolder"], image["type"], base_url ) output_images.append({"url": url}) return {"data": output_images} ``` **After:** ```python history = get_history(prompt_id, base_url, api_key)[prompt_id] for node_id in history["outputs"]: node_output = history["outputs"][node_id] if node_id in prompt and prompt[node_id].get("class_type") in ["SaveImage", "PreviewImage"]: if "images" in node_output: for image in node_output["images"]: url = get_image_url( image["filename"], image["subfolder"], image["type"], base_url ) output_images.append({"url": url}) return {"data": output_images} ``` This change ensures that only nodes with the `class_type` of `SaveImage` or `PreviewImage` are returned to the chat, effectively filtering out intermediate "IMAGE" outputs from nodes like `MaskToImage`, `CutByMask`, or `FaceSegmentation`, etc. ### Actual Behavior Even if a user only includes a single `Save Image` or `Preview Image` node, Open WebUI's current implementation retrieves every possible image in the workflow's execution history. This results in a cluttered chat experience where internal processing steps are shown as final outputs. ### Steps to Reproduce 1. Have some ComfyUI workflow that have a node that have image output on it (even this image output is not pointed to any preview/save node), like Cut by Mask, Convert Mask to Image, Paste Image by Mask, etc. 2. If your workflow has 4 nodes that have image output (remember, it's NOT connected into any preview/save node) and 1 actual node as output (preview / save node), it will give us 5 images in total, not 1. ### Logs & Screenshots ``` [open-webui] | 2025-12-24 13:34:49.212 | INFO | open_webui.utils.images.comfyui:queue_prompt:20 - queue_prompt [open-webui] | 2025-12-24 13:35:12.122 | INFO | open_webui.utils.images.comfyui:get_history:57 - get_history [open-webui] | 2025-12-24 13:35:12.131 | INFO | open_webui.utils.images.comfyui:get_image_url:50 - get_image [open-webui] | 2025-12-24 13:35:12.131 | INFO | open_webui.utils.images.comfyui:get_image_url:50 - get_image [open-webui] | 2025-12-24 13:35:12.131 | INFO | open_webui.utils.images.comfyui:get_image_url:50 - get_image [open-webui] | 2025-12-24 13:35:12.131 | INFO | open_webui.utils.images.comfyui:get_image_url:50 - get_image [open-webui] | 2025-12-24 13:35:12.131 | INFO | open_webui.utils.images.comfyui:get_image_url:50 - get_image [open-webui] | 2025-12-24 13:35:12.140 | INFO | open_webui.routers.files:upload_file_handler:185 - file.content_type: image/png False [open-webui] | 2025-12-24 13:35:12.583 | INFO | open_webui.routers.files:upload_file_handler:185 - file.content_type: image/png False [open-webui] | 2025-12-24 13:35:12.606 | INFO | open_webui.routers.files:upload_file_handler:185 - file.content_type: image/png False [open-webui] | 2025-12-24 13:35:13.040 | INFO | open_webui.routers.files:upload_file_handler:185 - file.content_type: image/png False [open-webui] | 2025-12-24 13:35:13.305 | INFO | open_webui.routers.files:upload_file_handler:185 - file.content_type: image/png False [open-webui] | 2025-12-24 13:35:13.326 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 10.100.0.2:36594 - "POST /api/v1/images/generations HTTP/1.1" 200 [open-webui] | 2025-12-24 13:35:13.422 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 10.100.0.2:36594 - "GET /api/v1/files/144d9dbd-1ab9-4e1d-b97f-e147576a3c73/content HTTP/1.1" 200 [open-webui] | 2025-12-24 13:35:13.423 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 10.100.0.2:36046 - "GET /api/v1/files/75e21195-c61d-4f64-87f3-2f24eb9d7a1b/content HTTP/1.1" 200 [open-webui] | 2025-12-24 13:35:13.423 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 10.100.0.2:36036 - "GET /api/v1/files/19833916-9adb-4c29-8baf-38f13a213f17/content HTTP/1.1" 200 [open-webui] | 2025-12-24 13:35:13.424 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 10.100.0.2:36050 - "GET /api/v1/files/fa5c8db5-4c83-4a83-885b-2ca169c26cf6/content HTTP/1.1" 200 [open-webui] | 2025-12-24 13:35:13.424 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 10.100.0.2:36054 - "GET /api/v1/files/9e460cd1-3b87-4064-b5ee-67908bcc1d55/content HTTP/1.1" 200 [open-webui] | 2025-12-24 13:35:13.509 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 10.100.0.2:36060 - "POST /api/v1/chats/86481ff8-b175-4df8-b614-385c9dce4243 HTTP/1.1" 200 [open-webui] | 2025-12-24 13:35:13.526 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 10.100.0.2:36060 - "GET /api/v1/chats/?page=1 HTTP/1.1" 200 ``` It gives us 5 duplicate images instead of just 1 final result from "Preview Image" or "Save Image". ### Additional Information _No response_
GiteaMirror added the bug label 2026-05-05 21:35:12 -05:00
Author
Owner

@owui-terminator[bot] commented on GitHub (Dec 24, 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. #19393 issue: shared chats with images - images won't show
    by Classic298 • Nov 23, 2025 • bug

  2. #20091 issue: image is regarded as binary in temp chat
    by funnycups • Dec 22, 2025 • bug

  3. #20095 issue: temporary chat causes image attachments to appear as text
    by mudkipdev • Dec 22, 2025 • bug

  4. #19816 issue: duplicated images when using openrouter
    by M0n7y5 • Dec 08, 2025 • bug

  5. #18995 issue: image generation and edition doesn’t work on temporary chats
    by futureshield • Nov 06, 2025 • bug

Show 5 more related issues
  1. #19987 issue: There is a lack of visual consistency between the home page and the chat interface.
    by i-iooi-i • Dec 16, 2025 • bug

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

  3. #11739 issue: Generated image is duplicated on some ComfyUI workflows
    by ud-klee • Mar 16, 2025 • bug

  4. #16953 issue: When switching to another chat while the image is being generated, the original chat cannot display the generated image properly.
    by haochiu • Aug 27, 2025 • bug

  5. #16799 issue: ComfyUI image generation broken in v0.6.23
    by links486 • Aug 22, 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:3690090602 --> @owui-terminator[bot] commented on GitHub (Dec 24, 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. [#19393](https://github.com/open-webui/open-webui/issues/19393) **issue: shared chats with images - images won't show** *by Classic298 • Nov 23, 2025 • `bug`* 2. [#20091](https://github.com/open-webui/open-webui/issues/20091) **issue: image is regarded as binary in temp chat** *by funnycups • Dec 22, 2025 • `bug`* 3. [#20095](https://github.com/open-webui/open-webui/issues/20095) **issue: temporary chat causes image attachments to appear as text** *by mudkipdev • Dec 22, 2025 • `bug`* 4. [#19816](https://github.com/open-webui/open-webui/issues/19816) **issue: duplicated images when using openrouter** *by M0n7y5 • Dec 08, 2025 • `bug`* 5. [#18995](https://github.com/open-webui/open-webui/issues/18995) **issue: image generation and edition doesn’t work on temporary chats** *by futureshield • Nov 06, 2025 • `bug`* <details> <summary>Show 5 more related issues</summary> 6. [#19987](https://github.com/open-webui/open-webui/issues/19987) **issue: There is a lack of visual consistency between the home page and the chat interface.** *by i-iooi-i • Dec 16, 2025 • `bug`* 7. [#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`* 8. [#11739](https://github.com/open-webui/open-webui/issues/11739) **issue: Generated image is duplicated on some ComfyUI workflows** *by ud-klee • Mar 16, 2025 • `bug`* 9. [#16953](https://github.com/open-webui/open-webui/issues/16953) **issue: When switching to another chat while the image is being generated, the original chat cannot display the generated image properly.** *by haochiu • Aug 27, 2025 • `bug`* 10. [#16799](https://github.com/open-webui/open-webui/issues/16799) **issue: ComfyUI image generation broken in v0.6.23** *by links486 • Aug 22, 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.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#57774