mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-16 14:39:31 -05:00
[GH-ISSUE #24630] bug: SafeWebBaseLoader._fetch() passes allow_redirects twice → TypeError on every async web search fetch
#74967
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @da-astro on GitHub (May 12, 2026).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/24630
Check Existing Issues
Installation Method
Docker
Open WebUI Version
v0.9.5
Ollama Version (if applicable)
0.23.2
Operating System
Ubuntu Server 24.04 (Linux x86_64)
Browser (if applicable)
Brave 1.7x / N/A — bug reproduces via curl, no browser needed
Confirmation
README.md.Expected Behavior
When a user submits a chat query with
features.web_search: trueagainst a workspace model that has web search enabled, Open WebUI's web search pipeline should:SafeWebBaseLoaderto fetch each URL.Each
sources[].source.docs[].contentfield in the response should contain the extracted page text (typically thousands of characters per URL).Actual Behavior
Every URL returned by the search engine fails to fetch. The
sources[]array is populated with URL metadata, but everycontentfield is an empty string"". The model then responds from its training data only, with no web context — defeating the purpose of the web search feature.The failure is silent because
continue_on_failure=Trueis hardcoded inget_web_loader(). All 18 fetches "complete" in <10ms total (visible in logs asFetching pages: 100%|##########| 18/18 [00:00<00:00, 1489.52it/s]), which shows that exceptions are firing before any I/O happens.Running with
continue_on_failure=Falseto surface the suppressed exception reveals:Issue
In
backend/open_webui/retrieval/web/utils.py,SafeWebBaseLoader.__init__()injectsallow_redirectsintoself.requests_kwargs:Then
_fetch()(line ~525) callssession.get()withallow_redirectspassed both via**(self.requests_kwargs | kwargs)and as an explicit kwarg:Python raises
TypeError: got multiple values for keyword argument 'allow_redirects'. langchain catches it viacontinue_on_failure=Trueand proceeds with empty content.The synchronous
load()path (usingself.session.get()withrequests) is unaffected becauserequestsdoesn't reject duplicate kwargs the same way. So manualSafeWebBaseLoader(...).load()succeeds and returns full content — but the production async path called byascrape_all()→fetch_all()→_fetch()always fails.Secondary issue (related, blocks fetches even after the TypeError is fixed)
get_web_loader()does not propagate theUSER_AGENTenvironment variable toSafeWebBaseLoader. After fixing the TypeError, fetches still fail (or return Cloudflare/anti-bot pages) because the session uses the defaultpython-requests/2.xUA. Settingself.session.headers['User-Agent'] = os.environ.get('USER_AGENT', '<default>')inSafeWebBaseLoader.__init__aftersuper().__init__()resolves this and gives a consistent UA across both sync and async paths.Proposed fix
Either:
(a) Don't inject
allow_redirectsintoself.requests_kwargsin__init__(it's already passed explicitly in_fetch), or(b) Pop it from the merged dict before the call:
And separately, propagate
USER_AGENTenv into the session headers.Steps to Reproduce
http://localhost:3000, complete signup, log in.llama3.2:latest)web_searchweb_searchllama32--web-search).chars.chars: 0.To surface the underlying exception:
This raises
TypeError: aiohttp.client.ClientSession.get() got multiple values for keyword argument 'allow_redirects'deterministically.Logs & Screenshots
Container log excerpt during a failing query (DEBUG level enabled via
GLOBAL_LOG_LEVEL=DEBUG):Full traceback (surfaced by setting
continue_on_failure=False):After applying the local patch (popping
allow_redirectsfrom the merged dict + setting USER_AGENT onself.session.headersin__init__), the same query returns real content — example sources from a"latest SpaceX news"query post-patch:Additional Information
Affects the default
:mainDocker image as of 2026-05-12.Reproduces with both DDGS backend and external Search providers — the bug is in the loader (
_fetch), not the search backend, so it impacts any web search provider whose pipeline usesSafeWebBaseLoader(which is the default and the recommended setting).The synchronous path is unaffected, so any user testing
WebBaseLoadermanually in a Python shell will see it "work" — masking the bug in real usage where only the async path is invoked.@owui-terminator[bot] commented on GitHub (May 12, 2026):
⚠️ Missing Issue Title Prefix
@da-astro, your issue title is missing a categorising prefix (e.g.
bug:,feat:,docs:).Please update the title to lead with one of:
Example:
bug: Login fails when the password contains special characters@owui-terminator[bot] commented on GitHub (May 12, 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:
🟢 #24560 issue: SafeWebBaseLoader._fetch crashes with TypeError on duplicate allow_redirects kwarg, breaking all web search in v0.9.5
This is the same root cause:
SafeWebBaseLoader._fetch()passesallow_redirectstwice, causing the aiohttp TypeError and leaving web-search source contents empty in the async path.by blaknite
🟣 #17815 issue: Web search fails at content fetching stage, despite container having full internet access.
This older web-search fetching failure is closely related because it also describes the pipeline succeeding at search but failing during URL content fetching, resulting in no web context being passed to the model.
by dmitrysrtx ·
bug🟣 #18290 Web Search returns incomplete or inconsistent results
This is related at a higher level because it reports web search returning too little/incomplete fetched content, which overlaps with the symptom of missing or empty fetched page content in the web-search pipeline.
by aimendenche-nw ·
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.
@da-astro commented on GitHub (May 12, 2026):
Duplicate of #24560