[GH-ISSUE #8880] "Exception in ASGI" Applicaiton when attempting to use Deepseek-R1--response never returns #53968

Closed
opened 2026-05-05 15:37:30 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @InconsolableCellist on GitHub (Jan 24, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/8880

Installation Method

pip install open-webui

Environment

  • Open WebUI Version: v0.5.7 (latest)

  • Ollama (if applicable): N/A

  • Operating System: Linux

  • Browser (if applicable): Waterfox

Confirmation:

  • I have read and followed all the instructions provided in the README.md.
  • I am on the latest version of both Open WebUI and Ollama.
  • [N/A] I have included the browser console logs.
  • [N/A] I have included the Docker container logs.
  • I have provided the exact steps to reproduce the bug in the "Steps to Reproduce" section below.

Expected Behavior:

Sending a message to Deepseek-R1 through OpenRouter works like any other model

Actual Behavior:

The response never progresses and remains in its initial loading state indefinitely. Repeated attempts sometimes make it load normally.

Description

Bug Summary:
Can't send messages to Deepseek-R1 using OpenRouter sometimes.

Reproduction Details

Steps to Reproduce:

  1. Configure Open WebUI to use Openrouter
  2. Select DeepSeek: DeepSeek R1 as the model
  3. Type some text and hit enter

Logs and Screenshots

Browser Console Logs:
N/A

Docker Container Logs:
N/A

Output logs:

ERROR:    Exception in ASGI application                                                                                             09:58:45 [94/10754]
  + Exception Group Traceback (most recent call last):                                                                                                 
  |   File "/home/user/ML/micromamba/envs/open-webui/lib/python3.11/site-packages/starlette/_utils.py", line 87, in collapse_excgroups              
  |     yield                                                                                                                                          
  |   File "/home/user/ML/micromamba/envs/open-webui/lib/python3.11/site-packages/starlette/middleware/base.py", line 190, in __call__              
  |     async with anyio.create_task_group() as task_group:                                                                                            
  |   File "/home/user/ML/micromamba/envs/open-webui/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 767, in __aexit__              
  |     raise BaseExceptionGroup(                                                                                                                      
  | ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception)                                                                                  
  +-+---------------- 1 ----------------                                                                                                               
    | Traceback (most recent call last):                                                                                                               
    |   File "/home/user/ML/micromamba/envs/open-webui/lib/python3.11/site-packages/uvicorn/protocols/http/httptools_impl.py", line 401, in run_asgi
    |     result = await app(  # type: ignore[func-returns-value]                                                                                      
    |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                      
    |   File "/home/user/ML/micromamba/envs/open-webui/lib/python3.11/site-packages/uvicorn/middleware/proxy_headers.py", line 70, in __call__      
    |     return await self.app(scope, receive, send)                                                                                                  
    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                  
    |   File "/home/user/ML/micromamba/envs/open-webui/lib/python3.11/site-packages/fastapi/applications.py", line 1054, in __call__                
    |     await super().__call__(scope, receive, send)                                                                                                 
    |   File "/home/user/ML/micromamba/envs/open-webui/lib/python3.11/site-packages/starlette/applications.py", line 123, in __call__               
    |     await self.middleware_stack(scope, receive, send)                                                                                            
    |   File "/home/user/ML/micromamba/envs/open-webui/lib/python3.11/site-packages/starlette/middleware/errors.py", line 186, in __call__          
    |     raise exc                                                                                                                                    
    |   File "/home/user/ML/micromamba/envs/open-webui/lib/python3.11/site-packages/starlette/middleware/errors.py", line 164, in __call__          
    |     await self.app(scope, receive, _send)                                                                                                        
    |   File "/home/user/ML/micromamba/envs/open-webui/lib/python3.11/site-packages/starlette/middleware/cors.py", line 85, in __call__             
    |     await self.app(scope, receive, send)                                                                                                         
    |   File "/home/user/ML/micromamba/envs/open-webui/lib/python3.11/site-packages/starlette/middleware/base.py", line 189, in __call__            
    |     with collapse_excgroups():                                                                                                                   
    |   File "/home/user/ML/micromamba/envs/open-webui/lib/python3.11/contextlib.py", line 158, in __exit__                                         
    |     self.gen.throw(typ, value, traceback)                                                                                                        
    |   File "/home/user/ML/micromamba/envs/open-webui/lib/python3.11/site-packages/starlette/_utils.py", line 93, in collapse_excgroups            
    |     raise exc                                                                                                                                    
    |   File "/home/user/ML/micromamba/envs/open-webui/lib/python3.11/site-packages/starlette/middleware/base.py", line 191, in __call__
    |     response = await self.dispatch_func(request, call_next)
    |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |   File "/home/user/ML/micromamba/envs/open-webui/lib/python3.11/site-packages/open_webui/main.py", line 732, in inspect_websocket
    |     return await call_next(request)
    |            ^^^^^^^^^^^^^^^^^^^^^^^^
    |   File "/home/user/ML/micromamba/envs/open-webui/lib/python3.11/site-packages/starlette/middleware/base.py", line 166, in call_next
    |     raise RuntimeError("No response returned.")
    | RuntimeError: No response returned.
    +------------------------------------

During handling of the above exception, another exception occurred:                                                                                    
                                                                                                                                                       
Traceback (most recent call last):                                                                                                                     
  File "/home/user/ML/micromamba/envs/open-webui/lib/python3.11/site-packages/uvicorn/protocols/http/httptools_impl.py", line 401, in run_asgi      
    result = await app(  # type: ignore[func-returns-value]                                                                                            
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                            
  File "/home/user/ML/micromamba/envs/open-webui/lib/python3.11/site-packages/uvicorn/middleware/proxy_headers.py", line 70, in __call__            
    return await self.app(scope, receive, send)                                                                                                        
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                        
  File "/home/user/ML/micromamba/envs/open-webui/lib/python3.11/site-packages/fastapi/applications.py", line 1054, in __call__                      
    await super().__call__(scope, receive, send)                                                                                                       
  File "/home/user/ML/micromamba/envs/open-webui/lib/python3.11/site-packages/starlette/applications.py", line 123, in __call__                     
    await self.middleware_stack(scope, receive, send)                                                                                                  
  File "/home/user/ML/micromamba/envs/open-webui/lib/python3.11/site-packages/starlette/middleware/errors.py", line 186, in __call__
    raise exc                                                                                                                                          
  File "/home/user/ML/micromamba/envs/open-webui/lib/python3.11/site-packages/starlette/middleware/errors.py", line 164, in __call__
    await self.app(scope, receive, _send)         
  File "/home/user/ML/micromamba/envs/open-webui/lib/python3.11/site-packages/starlette/middleware/cors.py", line 85, in __call__
    await self.app(scope, receive, send)                                                                                                               
  File "/home/user/ML/micromamba/envs/open-webui/lib/python3.11/site-packages/starlette/middleware/base.py", line 189, in __call__
    with collapse_excgroups():                                             
  File "/home/user/ML/micromamba/envs/open-webui/lib/python3.11/contextlib.py", line 158, in __exit__                                               
    self.gen.throw(typ, value, traceback)                                                                                                              
  File "/home/user/ML/micromamba/envs/open-webui/lib/python3.11/site-packages/starlette/_utils.py", line 93, in collapse_excgroups
    raise exc                                                                                                                                          
  File "/home/user/ML/micromamba/envs/open-webui/lib/python3.11/site-packages/starlette/middleware/base.py", line 191, in __call__
    response = await self.dispatch_func(request, call_next)                                                                                            
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/ML/micromamba/envs/open-webui/lib/python3.11/site-packages/open_webui/main.py", line 732, in inspect_websocket
    return await call_next(request)                                        
           ^^^^^^^^^^^^^^^^^^^^^^^^                                        
  File "/home/user/ML/micromamba/envs/open-webui/lib/python3.11/site-packages/starlette/middleware/base.py", line 166, in call_next
    raise RuntimeError("No response returned.")                                                                                                        
RuntimeError: No response returned.  

INFO:     100.79.138.113:60170 - "GET /api/v1/chats/?page=1 HTTP/1.1" 200 OK
ERROR [asyncio] Task exception was never retrieved
future: <Task finished name='Task-5059' coro=<process_chat_response.<locals>.post_response_handler() done, defined at /home/user/ML/micromamba/envs/open-webui/lib/python3.11/site-packages/open_webui/utils/middleware.py:1055> exception=AttributeError("'NoneType' object has no attribute 'strip'")>
Traceback (most recent call last):
  File "/home/user/ML/micromamba/envs/open-webui/lib/python3.11/site-packages/open_webui/utils/middleware.py", line 1254, in post_response_handler
    await background_tasks_handler()
  File "/home/user/ML/micromamba/envs/open-webui/lib/python3.11/site-packages/open_webui/utils/middleware.py", line 899, in background_tasks_handler
    ).strip()
      ^^^^^
AttributeError: 'NoneType' object has no attribute 'strip'
ERROR [asyncio] Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x77eeac17dc50>

Screenshots/Screen Recordings (if applicable):

Image

Additional Information

Originally created by @InconsolableCellist on GitHub (Jan 24, 2025). Original GitHub issue: https://github.com/open-webui/open-webui/issues/8880 ## Installation Method `pip install open-webui` ## Environment - **Open WebUI Version:** v0.5.7 [(latest)](https://github.com/open-webui/open-webui/releases/tag/v0.5.7) - **Ollama (if applicable):** N/A - **Operating System:** Linux - **Browser (if applicable):** Waterfox **Confirmation:** - [x] I have read and followed all the instructions provided in the README.md. - [x] I am on the latest version of both Open WebUI ~~and Ollama.~~ - [N/A] I have included the browser console logs. - [N/A] I have included the Docker container logs. - [x] I have provided the exact steps to reproduce the bug in the "Steps to Reproduce" section below. ## Expected Behavior: Sending a message to Deepseek-R1 through OpenRouter works like any other model ## Actual Behavior: The response never progresses and remains in its initial loading state indefinitely. Repeated attempts sometimes make it load normally. ## Description **Bug Summary:** Can't send messages to Deepseek-R1 using OpenRouter sometimes. ## Reproduction Details **Steps to Reproduce:** 1. Configure Open WebUI to use Openrouter 2. Select `DeepSeek: DeepSeek R1` as the model 3. Type some text and hit enter ## Logs and Screenshots **Browser Console Logs:** N/A **Docker Container Logs:** N/A **Output logs:** ``` ERROR: Exception in ASGI application 09:58:45 [94/10754] + Exception Group Traceback (most recent call last): | File "/home/user/ML/micromamba/envs/open-webui/lib/python3.11/site-packages/starlette/_utils.py", line 87, in collapse_excgroups | yield | File "/home/user/ML/micromamba/envs/open-webui/lib/python3.11/site-packages/starlette/middleware/base.py", line 190, in __call__ | async with anyio.create_task_group() as task_group: | File "/home/user/ML/micromamba/envs/open-webui/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 767, in __aexit__ | raise BaseExceptionGroup( | ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception) +-+---------------- 1 ---------------- | Traceback (most recent call last): | File "/home/user/ML/micromamba/envs/open-webui/lib/python3.11/site-packages/uvicorn/protocols/http/httptools_impl.py", line 401, in run_asgi | result = await app( # type: ignore[func-returns-value] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | File "/home/user/ML/micromamba/envs/open-webui/lib/python3.11/site-packages/uvicorn/middleware/proxy_headers.py", line 70, in __call__ | return await self.app(scope, receive, send) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | File "/home/user/ML/micromamba/envs/open-webui/lib/python3.11/site-packages/fastapi/applications.py", line 1054, in __call__ | await super().__call__(scope, receive, send) | File "/home/user/ML/micromamba/envs/open-webui/lib/python3.11/site-packages/starlette/applications.py", line 123, in __call__ | await self.middleware_stack(scope, receive, send) | File "/home/user/ML/micromamba/envs/open-webui/lib/python3.11/site-packages/starlette/middleware/errors.py", line 186, in __call__ | raise exc | File "/home/user/ML/micromamba/envs/open-webui/lib/python3.11/site-packages/starlette/middleware/errors.py", line 164, in __call__ | await self.app(scope, receive, _send) | File "/home/user/ML/micromamba/envs/open-webui/lib/python3.11/site-packages/starlette/middleware/cors.py", line 85, in __call__ | await self.app(scope, receive, send) | File "/home/user/ML/micromamba/envs/open-webui/lib/python3.11/site-packages/starlette/middleware/base.py", line 189, in __call__ | with collapse_excgroups(): | File "/home/user/ML/micromamba/envs/open-webui/lib/python3.11/contextlib.py", line 158, in __exit__ | self.gen.throw(typ, value, traceback) | File "/home/user/ML/micromamba/envs/open-webui/lib/python3.11/site-packages/starlette/_utils.py", line 93, in collapse_excgroups | raise exc | File "/home/user/ML/micromamba/envs/open-webui/lib/python3.11/site-packages/starlette/middleware/base.py", line 191, in __call__ | response = await self.dispatch_func(request, call_next) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | File "/home/user/ML/micromamba/envs/open-webui/lib/python3.11/site-packages/open_webui/main.py", line 732, in inspect_websocket | return await call_next(request) | ^^^^^^^^^^^^^^^^^^^^^^^^ | File "/home/user/ML/micromamba/envs/open-webui/lib/python3.11/site-packages/starlette/middleware/base.py", line 166, in call_next | raise RuntimeError("No response returned.") | RuntimeError: No response returned. +------------------------------------ During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/user/ML/micromamba/envs/open-webui/lib/python3.11/site-packages/uvicorn/protocols/http/httptools_impl.py", line 401, in run_asgi result = await app( # type: ignore[func-returns-value] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/user/ML/micromamba/envs/open-webui/lib/python3.11/site-packages/uvicorn/middleware/proxy_headers.py", line 70, in __call__ return await self.app(scope, receive, send) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/user/ML/micromamba/envs/open-webui/lib/python3.11/site-packages/fastapi/applications.py", line 1054, in __call__ await super().__call__(scope, receive, send) File "/home/user/ML/micromamba/envs/open-webui/lib/python3.11/site-packages/starlette/applications.py", line 123, in __call__ await self.middleware_stack(scope, receive, send) File "/home/user/ML/micromamba/envs/open-webui/lib/python3.11/site-packages/starlette/middleware/errors.py", line 186, in __call__ raise exc File "/home/user/ML/micromamba/envs/open-webui/lib/python3.11/site-packages/starlette/middleware/errors.py", line 164, in __call__ await self.app(scope, receive, _send) File "/home/user/ML/micromamba/envs/open-webui/lib/python3.11/site-packages/starlette/middleware/cors.py", line 85, in __call__ await self.app(scope, receive, send) File "/home/user/ML/micromamba/envs/open-webui/lib/python3.11/site-packages/starlette/middleware/base.py", line 189, in __call__ with collapse_excgroups(): File "/home/user/ML/micromamba/envs/open-webui/lib/python3.11/contextlib.py", line 158, in __exit__ self.gen.throw(typ, value, traceback) File "/home/user/ML/micromamba/envs/open-webui/lib/python3.11/site-packages/starlette/_utils.py", line 93, in collapse_excgroups raise exc File "/home/user/ML/micromamba/envs/open-webui/lib/python3.11/site-packages/starlette/middleware/base.py", line 191, in __call__ response = await self.dispatch_func(request, call_next) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/user/ML/micromamba/envs/open-webui/lib/python3.11/site-packages/open_webui/main.py", line 732, in inspect_websocket return await call_next(request) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/user/ML/micromamba/envs/open-webui/lib/python3.11/site-packages/starlette/middleware/base.py", line 166, in call_next raise RuntimeError("No response returned.") RuntimeError: No response returned. INFO: 100.79.138.113:60170 - "GET /api/v1/chats/?page=1 HTTP/1.1" 200 OK ERROR [asyncio] Task exception was never retrieved future: <Task finished name='Task-5059' coro=<process_chat_response.<locals>.post_response_handler() done, defined at /home/user/ML/micromamba/envs/open-webui/lib/python3.11/site-packages/open_webui/utils/middleware.py:1055> exception=AttributeError("'NoneType' object has no attribute 'strip'")> Traceback (most recent call last): File "/home/user/ML/micromamba/envs/open-webui/lib/python3.11/site-packages/open_webui/utils/middleware.py", line 1254, in post_response_handler await background_tasks_handler() File "/home/user/ML/micromamba/envs/open-webui/lib/python3.11/site-packages/open_webui/utils/middleware.py", line 899, in background_tasks_handler ).strip() ^^^^^ AttributeError: 'NoneType' object has no attribute 'strip' ERROR [asyncio] Unclosed client session client_session: <aiohttp.client.ClientSession object at 0x77eeac17dc50> ``` **Screenshots/Screen Recordings (if applicable):** ![Image](https://github.com/user-attachments/assets/fa09e81f-b17d-44a0-8c40-3376f50e9003) ## Additional Information
Author
Owner

@InconsolableCellist commented on GitHub (Jan 24, 2025):

I should note that Openrouter via DeepInfra still charged me for the generation, both in and out:

Image

So I believe the generation occurred, it just wasn't read properly.

<!-- gh-comment-id:2613248071 --> @InconsolableCellist commented on GitHub (Jan 24, 2025): I should note that Openrouter via DeepInfra still charged me for the generation, both in and out: ![Image](https://github.com/user-attachments/assets/168b123a-7f4f-465d-bd8b-c207859d88d6) So I believe the generation occurred, it just wasn't read properly.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#53968