Originally created by @SerenoV7 on GitHub (May 5, 2025).
Check Existing Issues
I have searched the existing issues and discussions.
I am using the latest version of Open WebUI.
Installation Method
Docker
Open WebUI Version
0.6.6
Ollama Version (if applicable)
No response
Operating System
Ubuntu 22.04.5 LTS x86_64 (Virtualized)
Browser (if applicable)
Zen Browser 1.12b (Firefox 138.0.1)
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 listed steps to reproduce the bug in detail.
Expected Behavior
When enabling search, the model is supposed to generate a search query and use that for the search
Actual Behavior
Instead of generating a search query, it errors out with Error: object of type 'NoneType' has no len() and searches that using whatever engine is provided (in my case duckduckgo)
Steps to Reproduce
Enable Web Search in the settings
Ask any model to search for anything
Logs & Screenshots
2025-05-05 20:30:28.670 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 81.56.30.233:0 - "POST /api/chat/completed HTTP/1.1" 200 - {}
2025-05-05 20:30:28.978 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 81.56.30.233:0 - "GET /api/v1/chats/?page=1 HTTP/1.1" 200 - {}
2025-05-05 20:30:29.034 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 81.56.30.233:0 - "POST /api/v1/chats/983eb8b6-c458-46fb-b2d4-999832ea3562 HTTP/1.1" 200 - {}
2025-05-05 20:30:29.673 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 81.56.30.233:0 - "GET /api/v1/chats/?page=1 HTTP/1.1" 200 - {}
2025-05-05 20:30:31.213 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 81.56.30.233:0 - "POST /api/v1/chats/983eb8b6-c458-46fb-b2d4-999832ea3562 HTTP/1.1" 200 - {}
2025-05-05 20:30:31.852 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 81.56.30.233:0 - "GET /api/v1/chats/?page=1 HTTP/1.1" 200 - {}
Original request body: {"model": "openrouter.google/gemini-2.0-flash-exp:free", "messages": [{"role": "user", "content": "### Task:\nAnalyze the chat history to determine the necessity of generating search queries, in the given language. By default, **prioritize generating 1-3 broad and relevant search queries** unless it is absolutely certain that no additional information is required. The aim is to retrieve comprehensive, updated, and valuable information even with minimal uncertainty. If no search is unequivocally ...
Extracted model ID: google/gemini-2.0-flash-exp:free
Sending non-streaming request to OpenRouter: {"model": "google/gemini-2.0-flash-exp:free", "messages": [{"role": "user", "content": "### Task:\nAnalyze the chat history to determine the necessity of generating search queries, in the given langua...
OpenRouter response keys: ['id', 'provider', 'model', 'object', 'created', 'choices', 'usage']
Message keys: ['role', 'content', 'refusal', 'reasoning']
Error in non_stream_response: object of type 'NoneType' has no len()
2025-05-05 20:30:34.069 | INFO | open_webui.routers.retrieval:process_web_search:1572 - trying to web search with ('duckduckgo', "Error: object of type 'NoneType' has no len()") - {}
2025-05-05 20:30:35.006 | INFO | duckduckgo_search.duckduckgo_search:_text_lite:274 - response: https://lite.duckduckgo.com/lite/ 200 - {}
Fetching pages: 100%|##########| 3/3 [00:00<00:00, 3.79it/s]
Original request body: {"model": "openrouter.google/gemini-2.0-flash-exp:free", "messages": [{"role": "user", "content": "### Task:\nAnalyze the chat history to determine the necessity of generating search queries, in the given language. By default, **prioritize generating 1-3 broad and relevant search queries** unless it is absolutely certain that no additional information is required. The aim is to retrieve comprehensive, updated, and valuable information even with minimal uncertainty. If no search is unequivocally ...
Extracted model ID: google/gemini-2.0-flash-exp:free
Sending non-streaming request to OpenRouter: {"model": "google/gemini-2.0-flash-exp:free", "messages": [{"role": "user", "content": "### Task:\nAnalyze the chat history to determine the necessity of generating search queries, in the given langua...
OpenRouter response keys: ['error', 'user_id']
Original request body: {"stream": true, "model": "openrouter.google/gemini-2.0-flash-exp:free", "messages": [{"role": "system", "content": "### Task:\nRespond to the user query using the provided context, incorporating inline citations in the format [id] **only when the <source> tag includes an explicit id attribute** (e.g., <source id=\"1\">).\n\n### Guidelines:\n- If you don't know the answer, clearly state that.\n- If uncertain, ask the user for clarification.\n- Respond in the same language as the user's query.\n-...
Extracted model ID: google/gemini-2.0-flash-exp:free
2025-05-05 20:30:39.703 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 81.56.30.233:0 - "POST /api/chat/completions HTTP/1.1" 200 - {}
2025-05-05 20:30:40.035 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 81.56.30.233:0 - "GET /api/v1/chats/?page=1 HTTP/1.1" 200 - {}
2025-05-05 20:30:40.065 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 81.56.30.233:0 - "POST /api/chat/completed HTTP/1.1" 200 - {}
2025-05-05 20:30:41.037 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 81.56.30.233:0 - "POST /api/v1/chats/983eb8b6-c458-46fb-b2d4-999832ea3562 HTTP/1.1" 200 - {}
2025-05-05 20:30:41.677 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 81.56.30.233:0 - "GET /api/v1/chats/?page=1 HTTP/1.1" 200 - {}```

### Additional Information
I use models from OpenRouter, whenever I try to use the search feature with whatever search engine I pick, it never manages to generate a search query and just constantly searches for `Error: object of type 'NoneType' has no len()`
Originally created by @SerenoV7 on GitHub (May 5, 2025).
### Check Existing Issues
- [x] I have searched the existing issues and discussions.
- [x] I am using the latest version of Open WebUI.
### Installation Method
Docker
### Open WebUI Version
0.6.6
### Ollama Version (if applicable)
_No response_
### Operating System
Ubuntu 22.04.5 LTS x86_64 (Virtualized)
### Browser (if applicable)
Zen Browser 1.12b (Firefox 138.0.1)
### 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 listed steps to reproduce the bug in detail.
### Expected Behavior
When enabling search, the model is supposed to generate a search query and use that for the search
### Actual Behavior
Instead of generating a search query, it errors out with `Error: object of type 'NoneType' has no len()` and searches that using whatever engine is provided (in my case duckduckgo)
### Steps to Reproduce
1. Enable Web Search in the settings
2. Ask any model to search for anything
### Logs & Screenshots
```2025-05-05 20:30:28.651 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 81.56.30.233:0 - "GET /api/v1/chats/?page=1 HTTP/1.1" 200 - {}
2025-05-05 20:30:28.670 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 81.56.30.233:0 - "POST /api/chat/completed HTTP/1.1" 200 - {}
2025-05-05 20:30:28.978 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 81.56.30.233:0 - "GET /api/v1/chats/?page=1 HTTP/1.1" 200 - {}
2025-05-05 20:30:29.034 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 81.56.30.233:0 - "POST /api/v1/chats/983eb8b6-c458-46fb-b2d4-999832ea3562 HTTP/1.1" 200 - {}
2025-05-05 20:30:29.673 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 81.56.30.233:0 - "GET /api/v1/chats/?page=1 HTTP/1.1" 200 - {}
2025-05-05 20:30:31.213 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 81.56.30.233:0 - "POST /api/v1/chats/983eb8b6-c458-46fb-b2d4-999832ea3562 HTTP/1.1" 200 - {}
2025-05-05 20:30:31.852 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 81.56.30.233:0 - "GET /api/v1/chats/?page=1 HTTP/1.1" 200 - {}
Original request body: {"model": "openrouter.google/gemini-2.0-flash-exp:free", "messages": [{"role": "user", "content": "### Task:\nAnalyze the chat history to determine the necessity of generating search queries, in the given language. By default, **prioritize generating 1-3 broad and relevant search queries** unless it is absolutely certain that no additional information is required. The aim is to retrieve comprehensive, updated, and valuable information even with minimal uncertainty. If no search is unequivocally ...
Extracted model ID: google/gemini-2.0-flash-exp:free
Sending non-streaming request to OpenRouter: {"model": "google/gemini-2.0-flash-exp:free", "messages": [{"role": "user", "content": "### Task:\nAnalyze the chat history to determine the necessity of generating search queries, in the given langua...
OpenRouter response keys: ['id', 'provider', 'model', 'object', 'created', 'choices', 'usage']
Message keys: ['role', 'content', 'refusal', 'reasoning']
Error in non_stream_response: object of type 'NoneType' has no len()
2025-05-05 20:30:34.069 | INFO | open_webui.routers.retrieval:process_web_search:1572 - trying to web search with ('duckduckgo', "Error: object of type 'NoneType' has no len()") - {}
2025-05-05 20:30:35.006 | INFO | duckduckgo_search.duckduckgo_search:_text_lite:274 - response: https://lite.duckduckgo.com/lite/ 200 - {}
Fetching pages: 100%|##########| 3/3 [00:00<00:00, 3.79it/s]
Original request body: {"model": "openrouter.google/gemini-2.0-flash-exp:free", "messages": [{"role": "user", "content": "### Task:\nAnalyze the chat history to determine the necessity of generating search queries, in the given language. By default, **prioritize generating 1-3 broad and relevant search queries** unless it is absolutely certain that no additional information is required. The aim is to retrieve comprehensive, updated, and valuable information even with minimal uncertainty. If no search is unequivocally ...
Extracted model ID: google/gemini-2.0-flash-exp:free
Sending non-streaming request to OpenRouter: {"model": "google/gemini-2.0-flash-exp:free", "messages": [{"role": "user", "content": "### Task:\nAnalyze the chat history to determine the necessity of generating search queries, in the given langua...
OpenRouter response keys: ['error', 'user_id']
Original request body: {"stream": true, "model": "openrouter.google/gemini-2.0-flash-exp:free", "messages": [{"role": "system", "content": "### Task:\nRespond to the user query using the provided context, incorporating inline citations in the format [id] **only when the <source> tag includes an explicit id attribute** (e.g., <source id=\"1\">).\n\n### Guidelines:\n- If you don't know the answer, clearly state that.\n- If uncertain, ask the user for clarification.\n- Respond in the same language as the user's query.\n-...
Extracted model ID: google/gemini-2.0-flash-exp:free
2025-05-05 20:30:39.703 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 81.56.30.233:0 - "POST /api/chat/completions HTTP/1.1" 200 - {}
2025-05-05 20:30:40.035 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 81.56.30.233:0 - "GET /api/v1/chats/?page=1 HTTP/1.1" 200 - {}
2025-05-05 20:30:40.065 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 81.56.30.233:0 - "POST /api/chat/completed HTTP/1.1" 200 - {}
2025-05-05 20:30:41.037 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 81.56.30.233:0 - "POST /api/v1/chats/983eb8b6-c458-46fb-b2d4-999832ea3562 HTTP/1.1" 200 - {}
2025-05-05 20:30:41.677 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 81.56.30.233:0 - "GET /api/v1/chats/?page=1 HTTP/1.1" 200 - {}```

### Additional Information
I use models from OpenRouter, whenever I try to use the search feature with whatever search engine I pick, it never manages to generate a search query and just constantly searches for `Error: object of type 'NoneType' has no len()`
GiteaMirror
added the bug label 2025-11-11 16:10:51 -06:00
Can you use the model openrouter.google/gemini-2.0-flash-exp:free normally in chat?
Otherwise try disabling search query generation in the admin settings.
@mMabeck commented on GitHub (May 6, 2025):
Can you use the model openrouter.google/gemini-2.0-flash-exp:free normally in chat?
Otherwise try disabling search query generation in the admin settings.
Can you use the model openrouter.google/gemini-2.0-flash-exp:free normally in chat? Otherwise try disabling search query generation in the admin settings.
Yes I can use all models from openrouter correctly in normal chat and they even work with image generation, but as soon as I try to do web search it breaks
@SerenoV7 commented on GitHub (May 6, 2025):
> Can you use the model openrouter.google/gemini-2.0-flash-exp:free normally in chat? Otherwise try disabling search query generation in the admin settings.
Yes I can use all models from openrouter correctly in normal chat and they even work with image generation, but as soon as I try to do web search it breaks
I don't really see any error messages in the logs. What RAG settings do you have set? what is your GLOBAL_LOG_LEVEL set to? It's odd that it would fail silently without logs.
@Classic298 commented on GitHub (May 6, 2025):
I don't really see any error messages in the logs. What RAG settings do you have set? what is your GLOBAL_LOG_LEVEL set to? It's odd that it would fail silently without logs.
I don't really see any error messages in the logs. What RAG settings do you have set? what is your GLOBAL_LOG_LEVEL set to? It's odd that it would fail silently without logs.
Most of my settings are just the defaults that come with OpenWebUI's Docker Image so dunno what to say
@SerenoV7 commented on GitHub (May 6, 2025):
> I don't really see any error messages in the logs. What RAG settings do you have set? what is your GLOBAL_LOG_LEVEL set to? It's odd that it would fail silently without logs.
Most of my settings are just the defaults that come with OpenWebUI's Docker Image so dunno what to say
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Originally created by @SerenoV7 on GitHub (May 5, 2025).
Check Existing Issues
Installation Method
Docker
Open WebUI Version
0.6.6
Ollama Version (if applicable)
No response
Operating System
Ubuntu 22.04.5 LTS x86_64 (Virtualized)
Browser (if applicable)
Zen Browser 1.12b (Firefox 138.0.1)
Confirmation
README.md.Expected Behavior
When enabling search, the model is supposed to generate a search query and use that for the search
Actual Behavior
Instead of generating a search query, it errors out with
Error: object of type 'NoneType' has no len()and searches that using whatever engine is provided (in my case duckduckgo)Steps to Reproduce
Logs & Screenshots
@mMabeck commented on GitHub (May 6, 2025):
Can you use the model openrouter.google/gemini-2.0-flash-exp:free normally in chat?
Otherwise try disabling search query generation in the admin settings.
@SerenoV7 commented on GitHub (May 6, 2025):
Yes I can use all models from openrouter correctly in normal chat and they even work with image generation, but as soon as I try to do web search it breaks
@Classic298 commented on GitHub (May 6, 2025):
I don't really see any error messages in the logs. What RAG settings do you have set? what is your GLOBAL_LOG_LEVEL set to? It's odd that it would fail silently without logs.
@SerenoV7 commented on GitHub (May 6, 2025):
Most of my settings are just the defaults that come with OpenWebUI's Docker Image so dunno what to say