[GH-ISSUE #18514] issue: Incorrect logic when uploading an image into a collection #18620

Closed
opened 2026-04-20 00:50:05 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @chayaziv on GitHub (Oct 22, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/18514

Check Existing Issues

  • I have searched for any existing and/or related issues.
  • I have searched for any existing and/or related discussions.
  • I am using the latest version of Open WebUI.

Installation Method

Git Clone

Open WebUI Version

v0.6.32

Ollama Version (if applicable)

No response

Operating System

Windows 10

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 you upload an image to a collection, and 'content extraction engine' is document intelligence, there will be an appropriate alerts that informs you that the file has been added successfully but the extract content is not available for this file.

Actual Behavior

The system tries to upload the file and it remains in the pedding state forever, the user sees a spinner that spins and does not finish without any appropriate message.

Steps to Reproduce

  • set CONTENT_EXTRACTION_ENGINE to 'document_intelligence'
  • create new collection
  • upload jpeg file
  • see the spinner without stop or appropriate alert

Logs & Screenshots

Additional Information

🛠 Root Cause Analysis

The issue is in the file:
backend/open_webui/routers/files.py at lines 114-117:

elif (not file.content_type.startswith(("image/", "video/"))) or (
    request.app.state.config.CONTENT_EXTRACTION_ENGINE == "external"
):
    process_file(request, ProcessFileForm(file_id=file_item.id), user=user)
# ❌ MISSING: No else clause to handle images without external engine!

The Problem:

When a JPEG file (or any image) is uploaded without an external content extraction engine configured:

  1. The elif condition evaluates to FALSE (it IS an image AND no external engine)
  2. process_file() is NOT called
  3. No else clause exists to handle this case
  4. File status remains "pending" forever
  5. Frontend waits indefinitely → infinite spinner

Why it happens:

  • For JPEG: file.content_type = "image/jpeg"
  • First check: not file.content_type.startswith(("image/", "video/"))FALSE
  • Second check: CONTENT_EXTRACTION_ENGINE == "external"FALSE (CONTENT_EXTRACTION_ENGINE set to 'document_intelligence' )
  • Combined: FALSE → code path not executed
  • No fallback handling → file stuck in pending state

💡 Proposed Fix

Add the missing else clause in the file:
backend/open_webui/routers/files.py (after line 117)

elif (not file.content_type.startswith(("image/", "video/"))) or (
    request.app.state.config.CONTENT_EXTRACTION_ENGINE == "external"
):
    process_file(request, ProcessFileForm(file_id=file_item.id), user=user)
else:
    # Add this else block to handle unsupported image/video files
    log.warning(
        f"File {file_item.id} with content type {file.content_type} cannot be processed. "
        f"External content extraction engine is not configured."
    )
    Files.update_file_data_by_id(
        file_item.id,
        {
            "status": "failed",
            "error": ERROR_MESSAGES.FILE_NOT_PROCESSED,
        },
    )

What this fixes:

  • Sets file status to "failed" immediately
  • Provides clear error message to user
  • Stops infinite spinner in frontend

Originally created by @chayaziv on GitHub (Oct 22, 2025). Original GitHub issue: https://github.com/open-webui/open-webui/issues/18514 ### 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 am using the latest version of Open WebUI. ### Installation Method Git Clone ### Open WebUI Version v0.6.32 ### Ollama Version (if applicable) _No response_ ### Operating System Windows 10 ### 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 you upload an image to a collection, and 'content extraction engine' is **document intelligence**, there will be an appropriate alerts that informs you that the file has been added successfully but the extract content is not available for this file. ### Actual Behavior The system tries to upload the file and it remains in the pedding state forever, the user sees a spinner that spins and does not finish without any appropriate message. ### Steps to Reproduce - set CONTENT_EXTRACTION_ENGINE to '**document_intelligence**' - create new collection - upload jpeg file - see the spinner without stop or appropriate alert ### Logs & Screenshots - ### Additional Information ## 🛠 Root Cause Analysis The issue is in the file: **`backend/open_webui/routers/files.py`** at lines **114-117**: ```python elif (not file.content_type.startswith(("image/", "video/"))) or ( request.app.state.config.CONTENT_EXTRACTION_ENGINE == "external" ): process_file(request, ProcessFileForm(file_id=file_item.id), user=user) # ❌ MISSING: No else clause to handle images without external engine! ``` **The Problem:** When a JPEG file (or any image) is uploaded without an external content extraction engine configured: 1. The `elif` condition evaluates to **FALSE** (it IS an image AND no external engine) 2. `process_file()` is **NOT called** 3. **No `else` clause exists** to handle this case 4. File status remains **"pending"** forever 5. Frontend waits indefinitely → **infinite spinner** ⏳ **Why it happens:** - For JPEG: `file.content_type = "image/jpeg"` - First check: `not file.content_type.startswith(("image/", "video/"))` → **FALSE** - Second check: `CONTENT_EXTRACTION_ENGINE == "external"` → **FALSE** (CONTENT_EXTRACTION_ENGINE set to 'document_intelligence' ) - Combined: **FALSE** → code path not executed - **No fallback handling** → file stuck in pending state --- ## 💡 Proposed Fix Add the missing `else` clause in the file: **`backend/open_webui/routers/files.py`** (after line 117) ```python elif (not file.content_type.startswith(("image/", "video/"))) or ( request.app.state.config.CONTENT_EXTRACTION_ENGINE == "external" ): process_file(request, ProcessFileForm(file_id=file_item.id), user=user) else: # Add this else block to handle unsupported image/video files log.warning( f"File {file_item.id} with content type {file.content_type} cannot be processed. " f"External content extraction engine is not configured." ) Files.update_file_data_by_id( file_item.id, { "status": "failed", "error": ERROR_MESSAGES.FILE_NOT_PROCESSED, }, ) ``` **What this fixes:** - ✅ Sets file status to **"failed"** immediately - ✅ Provides clear error message to user - ✅ Stops infinite spinner in frontend ---
GiteaMirror added the bug label 2026-04-20 00:50:05 -05:00
Author
Owner

@silentoplayz commented on GitHub (Oct 24, 2025):

PR is welcome!

<!-- gh-comment-id:3443681157 --> @silentoplayz commented on GitHub (Oct 24, 2025): PR is welcome!
Author
Owner

@tjbck commented on GitHub (Oct 28, 2025):

Addressed with f524a6a8e7 in dev!

<!-- gh-comment-id:3455000315 --> @tjbck commented on GitHub (Oct 28, 2025): Addressed with f524a6a8e7d10754d21b81a59fbf75f4cfa63213 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#18620