[GH-ISSUE #24856] issue: Pasting a youtu.be short URL returns 400 "content provided is empty" due to allow_redirects=False #123725

Closed
opened 2026-05-21 03:11:55 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @AirRunner on GitHub (May 18, 2026).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/24856

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

Pip Install

Open WebUI Version

v0.9.5

Ollama Version (if applicable)

No response

Operating System

macOS Tahoe 26.5

Browser (if applicable)

Safari 26.5

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

Pasting a youtu.be short URL into the chat should load the YouTube transcript via YoutubeLoader, exactly as it does when using the full https://www.youtube.com/watch?v= URL.

Actual Behavior

The request returns HTTP 400 with:

{"detail": "[ERROR: The content provided is empty. Please ensure that there is text or data present before proceeding.]"}

The UI shows an infinite spinner. No transcript is loaded.

Using the equivalent full youtube.com/watch?v= URL works correctly.

Steps to Reproduce

  1. Install Open WebUI v0.9.5 via pip install open-webui on Python 3.12.
  2. Start the server: open-webui serve.
  3. Open a new chat.
  4. Type # + paste a youtu.be short URL directly into the chat input
  5. Observe the 400 error. The spinner runs indefinitely.
  6. Replace the URL with the full form https://www.youtube.com/watch?v= and paste again, it succeeds.

Logs & Screenshots

Server log failure with youtu.be:

POST /api/v1/retrieval/process/youtube HTTP/1.1" 400 Bad Request
ERROR: The content provided is empty. Please ensure that there is text or data present before proceeding.

Browser network tab (Safari DevTools):

{"detail": "[ERROR: The content provided is empty. Please ensure that there is text or data present before proceeding.]"}

Server log success with youtube.com/watch?v=:

POST /api/v1/retrieval/process/youtube HTTP/1.1" 200 OK

Additional Information

Root cause

In open_webui/retrieval/utils.py, get_content_from_url() performs a HEAD-like probe to determine the content type before deciding whether to invoke YoutubeLoader or a binary extractor:

response = requests.get(url, stream=True, timeout=30, allow_redirects=AIOHTTP_CLIENT_ALLOW_REDIRECTS)

AIOHTTP_CLIENT_ALLOW_REDIRECTS defaults to False. When the URL is https://youtu.be/..., YouTube responds with HTTP 303 and Content-Type: application/binary. Since redirects are not followed, _is_text_content_type('application/binary') returns False, and the code falls through to the binary content handler, bypassing YoutubeLoader entirely. The binary handler extracts no text, resulting in empty docs and the EMPTY_CONTENT error.

With https://www.youtube.com/watch?v=..., there is no redirect, the probe gets HTTP 200 with text/html, _is_text_content_type() returns True, and YoutubeLoader is correctly invoked.

Note: is_youtube_url() already exists in the same file and matches both youtube.com and youtu.be, so the URL is correctly identified as YouTube, but only in get_loader(), which is never reached for youtu.be URLs due to the probe short-circuiting the flow.

Proposed fix

One possible fix would be to bypass the content-type probe for URLs where is_youtube_url() is true, since YoutubeLoader uses youtube-transcript-api directly and does not make the redirected HTTP request.

Originally created by @AirRunner on GitHub (May 18, 2026). Original GitHub issue: https://github.com/open-webui/open-webui/issues/24856 ### 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 Pip Install ### Open WebUI Version v0.9.5 ### Ollama Version (if applicable) _No response_ ### Operating System macOS Tahoe 26.5 ### Browser (if applicable) Safari 26.5 ### 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 Pasting a `youtu.be` short URL into the chat should load the YouTube transcript via `YoutubeLoader`, exactly as it does when using the full `https://www.youtube.com/watch?v=` URL. ### Actual Behavior The request returns HTTP 400 with: ```json {"detail": "[ERROR: The content provided is empty. Please ensure that there is text or data present before proceeding.]"} ``` The UI shows an infinite spinner. No transcript is loaded. Using the equivalent full `youtube.com/watch?v=` URL works correctly. ### Steps to Reproduce 1. Install Open WebUI v0.9.5 via `pip install open-webui` on Python 3.12. 2. Start the server: `open-webui serve`. 3. Open a new chat. 4. Type `#` + paste a `youtu.be` short URL directly into the chat input 5. Observe the 400 error. The spinner runs indefinitely. 6. Replace the URL with the full form `https://www.youtube.com/watch?v=` and paste again, it succeeds. ### Logs & Screenshots Server log failure with `youtu.be`: ``` POST /api/v1/retrieval/process/youtube HTTP/1.1" 400 Bad Request ERROR: The content provided is empty. Please ensure that there is text or data present before proceeding. ``` Browser network tab (Safari DevTools): ```json {"detail": "[ERROR: The content provided is empty. Please ensure that there is text or data present before proceeding.]"} ``` --- Server log success with `youtube.com/watch?v=`: ``` POST /api/v1/retrieval/process/youtube HTTP/1.1" 200 OK ``` ### Additional Information ## Root cause In `open_webui/retrieval/utils.py`, `get_content_from_url()` performs a HEAD-like probe to determine the content type before deciding whether to invoke `YoutubeLoader` or a binary extractor: ```python response = requests.get(url, stream=True, timeout=30, allow_redirects=AIOHTTP_CLIENT_ALLOW_REDIRECTS) ``` `AIOHTTP_CLIENT_ALLOW_REDIRECTS` defaults to `False`. When the URL is `https://youtu.be/...`, YouTube responds with **HTTP 303** and `Content-Type: application/binary`. Since redirects are not followed, `_is_text_content_type('application/binary')` returns `False`, and the code falls through to the binary content handler, bypassing `YoutubeLoader` entirely. The binary handler extracts no text, resulting in empty docs and the EMPTY_CONTENT error. With `https://www.youtube.com/watch?v=...`, there is no redirect, the probe gets HTTP 200 with `text/html`, `_is_text_content_type()` returns `True`, and `YoutubeLoader` is correctly invoked. Note: `is_youtube_url()` already exists in the same file and matches both `youtube.com` and `youtu.be`, so the URL is correctly identified as YouTube, but only in `get_loader()`, which is never reached for `youtu.be` URLs due to the probe short-circuiting the flow. ## Proposed fix One possible fix would be to bypass the content-type probe for URLs where `is_youtube_url()` is true, since `YoutubeLoader` uses `youtube-transcript-api` directly and does not make the redirected HTTP request.
GiteaMirror added the bug label 2026-05-21 03:11:55 -05:00
Author
Owner

@owui-terminator[bot] commented on GitHub (May 18, 2026):

🔍 Related Issues Found

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

  1. 🟣 #2110 Youtube RAG Shortcut URL Update
    This issue is directly about the same gap: shortened YouTube URLs (youtu.be) were not being recognized for RAG/paste handling, and the proposed fix was to include youtu.be. Your new issue is the backend-side manifestation of that same short-URL path failing.
    by thebetauser

  2. 🟣 #7077 issue: youtube error
    This earlier bug report shows the same user-visible failure mode: YouTube extraction via #<youtube url> returns the empty-content 400 error. Although it focused on full URLs and an older version, it is clearly the same retrieval pipeline and same error class.
    by hongbo-miao

  3. 🟣 #6208 issue: youtube video errors
    This is another YouTube extraction failure in the same feature area (process/youtube) with related logs and loader behavior. The underlying cause differs, but it is still useful context for repeated YouTube transcript/loading issues in Open WebUI.
    by zabirauf

  4. 🟣 #14752 issue: Youtube Link Embed Bug: '[ERROR: no element found: line 1, column 0]'
    This issue is about YouTube link embedding in the chat input and demonstrates another frontend-facing failure around YouTube URL handling. It is related to the same user workflow of pasting a YouTube link, even though the exact error differs.
    by lucyknada · bug


💡 If your issue is a duplicate, please close it and add any additional details to the existing issue instead.

This comment was generated automatically. React with 👍 if helpful, 👎 if not.

<!-- gh-comment-id:4472960704 --> @owui-terminator[bot] commented on GitHub (May 18, 2026): <!-- terminator-bot:related-issues-reply --> 🔍 **Related Issues Found** I found some existing issues that might be related. Please check if any of these are duplicates or contain helpful solutions: 1. 🟣 [#2110](https://github.com/open-webui/open-webui/issues/2110) **Youtube RAG Shortcut URL Update** *This issue is directly about the same gap: shortened YouTube URLs (`youtu.be`) were not being recognized for RAG/paste handling, and the proposed fix was to include `youtu.be`. Your new issue is the backend-side manifestation of that same short-URL path failing.* *by thebetauser* 2. 🟣 [#7077](https://github.com/open-webui/open-webui/issues/7077) **issue: youtube error** *This earlier bug report shows the same user-visible failure mode: YouTube extraction via `#<youtube url>` returns the empty-content 400 error. Although it focused on full URLs and an older version, it is clearly the same retrieval pipeline and same error class.* *by hongbo-miao* 3. 🟣 [#6208](https://github.com/open-webui/open-webui/issues/6208) **issue: youtube video errors** *This is another YouTube extraction failure in the same feature area (`process/youtube`) with related logs and loader behavior. The underlying cause differs, but it is still useful context for repeated YouTube transcript/loading issues in Open WebUI.* *by zabirauf* 4. 🟣 [#14752](https://github.com/open-webui/open-webui/issues/14752) **issue: Youtube Link Embed Bug: '[ERROR: no element found: line 1, column 0]'** *This issue is about YouTube link embedding in the chat input and demonstrates another frontend-facing failure around YouTube URL handling. It is related to the same user workflow of pasting a YouTube link, even though the exact error differs.* *by lucyknada · `bug`* --- 💡 If your issue is a duplicate, please close it and add any additional details to the existing issue instead. *This comment was generated automatically.* React with 👍 if helpful, 👎 if not.
Author
Owner

@tjbck commented on GitHub (May 19, 2026):

Addressed in dev!

<!-- gh-comment-id:4490071344 --> @tjbck commented on GitHub (May 19, 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#123725