[GH-ISSUE #4158] bug: [object Object] error when sending subsequent messages to the chat. #29046

Closed
opened 2026-04-25 03:30:18 -05:00 by GiteaMirror · 31 comments
Owner

Originally created by @fracergu on GitHub (Jul 27, 2024).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/4158

Bug Report

Description

Bug Summary:
When using Open WebUI with an OpenAI API key, sending a second message in the chat occasionally results in no response. Refreshing the browser shows an error with the content [object Object]. Sometimes, it regenerates another response or duplicates the chat.

Steps to Reproduce:

  1. Launch Open WebUI with an OpenAI API key.
  2. Send a message in the chat.
  3. Wait for the response.
  4. Send a second message.
  5. Observe the response, or lack thereof.
  6. Refresh the browser to see if an error occurs.

Expected Behavior:
The application should respond to the second message without any issues and should not throw errors or duplicate chat entries.

Actual Behavior:
Sometimes the application does not respond after sending the second message. A page refresh yields an error showing [object Object]. Other times, it generates another response or duplicates the chat.

Environment

  • Open WebUI Version: 0.3.10

  • Ollama (if applicable): Not using ollama

  • Operating System: Server is running Debian 12, Clients Windows 11 and Arch

  • Browser (if applicable): Tested in Chrome 127.0.6533.73 and Firefox 128.0.3

Reproduction Details

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.
  • I have included the browser console logs.
  • I have included the Docker container logs.

Logs and Screenshots

Browser Console Logs:
I have recorded the issue on this jam, console logs and network requests can be checked here.

Docker Container Logs:
[Include relevant Docker container logs, if applicable]
Did not see anything relevant on the logs far away than the 500s that can be checked on the jam. Anyways here they are on pastebin (my public ip obfuscated and will be destroyed in 6 months)

Screenshots (if applicable):
image

Installation Method

I have installed the app with the following docker-compose file:

services:
  open-webui:
    container_name: open-webui
    image: ghcr.io/open-webui/open-webui:main
    restart: always
    environment:
      - OPENAI_API_KEY=my-api-key
    volumes:
      - open-webui:/app/backend/data
    networks:
      - proxy-network

volumes:
  open-webui:

networks:
  proxy-network:
    external: true

Additional Information

The issue can be reproduced consistently but does not occur every time. I've attempted testing in both Chrome and Firefox, including clean versions without extensions. I also have tested seveal models from OpenAI (4o, 4o-mini and 3.5-turbo) and happens on all of them.

Note

If the bug report is incomplete or does not follow the provided instructions, it may not be addressed. Please ensure that you have followed the steps outlined in the README.md and troubleshooting.md documents, and provide all necessary information for us to reproduce and address the issue. Thank you!

Originally created by @fracergu on GitHub (Jul 27, 2024). Original GitHub issue: https://github.com/open-webui/open-webui/issues/4158 # Bug Report ## Description **Bug Summary:** When using Open WebUI with an OpenAI API key, sending a second message in the chat occasionally results in no response. Refreshing the browser shows an error with the content [object Object]. Sometimes, it regenerates another response or duplicates the chat. **Steps to Reproduce:** 1. Launch Open WebUI with an OpenAI API key. 2. Send a message in the chat. 3. Wait for the response. 4. Send a second message. 5. Observe the response, or lack thereof. 6. Refresh the browser to see if an error occurs. **Expected Behavior:** The application should respond to the second message without any issues and should not throw errors or duplicate chat entries. **Actual Behavior:** Sometimes the application does not respond after sending the second message. A page refresh yields an error showing [object Object]. Other times, it generates another response or duplicates the chat. ## Environment - **Open WebUI Version:** 0.3.10 - **Ollama (if applicable):** Not using ollama - **Operating System:** Server is running Debian 12, Clients Windows 11 and Arch - **Browser (if applicable):** Tested in Chrome 127.0.6533.73 and Firefox 128.0.3 ## Reproduction Details **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. - [x] I have included the browser console logs. - [x] I have included the Docker container logs. ## Logs and Screenshots **Browser Console Logs:** I have recorded the issue on this [jam](https://jam.dev/c/3eaea634-9ebc-4cf5-af94-dce1b191e406), console logs and network requests can be checked here. **Docker Container Logs:** [Include relevant Docker container logs, if applicable] Did not see anything relevant on the logs far away than the 500s that can be checked on the jam. Anyways here they are on [pastebin](https://pastebin.com/6Vud3hwD) (my public ip obfuscated and will be destroyed in 6 months) **Screenshots (if applicable):** ![image](https://github.com/user-attachments/assets/9766f690-38c1-4242-a5c4-3014308fac0a) ## Installation Method I have installed the app with the following docker-compose file: ```yml services: open-webui: container_name: open-webui image: ghcr.io/open-webui/open-webui:main restart: always environment: - OPENAI_API_KEY=my-api-key volumes: - open-webui:/app/backend/data networks: - proxy-network volumes: open-webui: networks: proxy-network: external: true ``` ## Additional Information The issue can be reproduced consistently but does not occur every time. I've attempted testing in both Chrome and Firefox, including clean versions without extensions. I also have tested seveal models from OpenAI (4o, 4o-mini and 3.5-turbo) and happens on all of them. ## Note If the bug report is incomplete or does not follow the provided instructions, it may not be addressed. Please ensure that you have followed the steps outlined in the README.md and troubleshooting.md documents, and provide all necessary information for us to reproduce and address the issue. Thank you!
GiteaMirror added the good first issuehelp wanted labels 2026-04-25 03:30:18 -05:00
Author
Owner

@vika2603 commented on GitHub (Jul 28, 2024):

same problem

<!-- gh-comment-id:2254536573 --> @vika2603 commented on GitHub (Jul 28, 2024): same problem
Author
Owner

@JKratto commented on GitHub (Jul 28, 2024):

I see a similar behaviour when chatting with a local Ollama model. I send a message, receive response with no problems. Then I continue in the chat. My response does not appear in the chat window, the window is not responding. After refreshing the web page, I see the "object object" banner, sometimes with my "unsent" message present, sometimes without it. This did not happen before.

<!-- gh-comment-id:2254602808 --> @JKratto commented on GitHub (Jul 28, 2024): I see a similar behaviour when chatting with a local Ollama model. I send a message, receive response with no problems. Then I continue in the chat. My response does not appear in the chat window, the window is not responding. After refreshing the web page, I see the "object object" banner, sometimes with my "unsent" message present, sometimes without it. This did not happen before.
Author
Owner

@cstoicescu commented on GitHub (Jul 28, 2024):

Same problem here , i am using Groq, happens randomly with every model. I thing i noticed is that it happens after a long period of time i am authenticated and idle. I have to log out and relogin, or delete chat.

<!-- gh-comment-id:2254661520 --> @cstoicescu commented on GitHub (Jul 28, 2024): Same problem here , i am using Groq, happens randomly with every model. I thing i noticed is that it happens after a long period of time i am authenticated and idle. I have to log out and relogin, or delete chat.
Author
Owner

@fracergu commented on GitHub (Jul 29, 2024):

Changing issue title as it seems to happen also with local Ollama (I though initially it was related with OpenAI API)

<!-- gh-comment-id:2255323844 --> @fracergu commented on GitHub (Jul 29, 2024): Changing issue title as it seems to happen also with local Ollama (I though initially it was related with OpenAI API)
Author
Owner

@Akira-baa commented on GitHub (Jul 29, 2024):

Same error here since last update with Ollama

<!-- gh-comment-id:2255818124 --> @Akira-baa commented on GitHub (Jul 29, 2024): Same error here since last update with Ollama
Author
Owner

@Sturmkater commented on GitHub (Jul 30, 2024):

I see a similar behaviour when chatting with a local Ollama model. I send a message, receive response with no problems. Then I continue in the chat. My response does not appear in the chat window, the window is not responding. After refreshing the web page, I see the "object object" banner, sometimes with my "unsent" message present, sometimes without it. This did not happen before.

Same for me. Super annoying:-(

<!-- gh-comment-id:2258116108 --> @Sturmkater commented on GitHub (Jul 30, 2024): > I see a similar behaviour when chatting with a local Ollama model. I send a message, receive response with no problems. Then I continue in the chat. My response does not appear in the chat window, the window is not responding. After refreshing the web page, I see the "object object" banner, sometimes with my "unsent" message present, sometimes without it. This did not happen before. Same for me. Super annoying:-(
Author
Owner

@ticpu commented on GitHub (Jul 30, 2024):

I can confirm this happens with multiple OpenAI model in the non-Docker version as well. Installed directly as a service. It does appear like it is a web UI issue as trying to send a message instantly result as a popup like this without this:
image

And can see in the console:
submitPrompt 748f3048-58d4-4bdd-9ab3-8aaf5ac84bd1 2 Chat.svelte:404:10
Wake Lock released +layout.svelte:69:13
submitPrompt 748f3048-58d4-4bdd-9ab3-8aaf5ac84bd1 Chat.svelte:404:10
submitPrompt 748f3048-58d4-4bdd-9ab3-8aaf5ac84bd1 4 Chat.svelte:404:10
Wake Lock released +layout.svelte:69:13

​And there is still background network activity, so not completely frozen.

<!-- gh-comment-id:2258295858 --> @ticpu commented on GitHub (Jul 30, 2024): I can confirm this happens with multiple OpenAI model in the non-Docker version as well. Installed directly as a service. It does appear like it is a web UI issue as trying to send a message instantly result as a popup like this without this: ![image](https://github.com/user-attachments/assets/341eb076-61b8-4b8f-88bf-283b789f2434) And can see in the console: submitPrompt 748f3048-58d4-4bdd-9ab3-8aaf5ac84bd1 2 [Chat.svelte:404:10](https://ia.cauca.ca/src/lib/components/chat/Chat.svelte) Wake Lock released [+layout.svelte:69:13](https://ia.cauca.ca/src/routes/+layout.svelte) submitPrompt 748f3048-58d4-4bdd-9ab3-8aaf5ac84bd1 [Chat.svelte:404:10](https://ia.cauca.ca/src/lib/components/chat/Chat.svelte) submitPrompt 748f3048-58d4-4bdd-9ab3-8aaf5ac84bd1 4 [Chat.svelte:404:10](https://ia.cauca.ca/src/lib/components/chat/Chat.svelte) Wake Lock released [+layout.svelte:69:13](https://ia.cauca.ca/src/routes/+layout.svelte) ​And there is still background network activity, so not completely frozen.
Author
Owner

@Arthur-Llevelys commented on GitHub (Jul 30, 2024):

Same problem (Ollama 0.3.0 - Open UI 3.10)

<!-- gh-comment-id:2258609449 --> @Arthur-Llevelys commented on GitHub (Jul 30, 2024): Same problem (Ollama 0.3.0 - Open UI 3.10)
Author
Owner

@KangBuilds commented on GitHub (Jul 31, 2024):

Same problem here (v0.3.10, GPT-4o)

<!-- gh-comment-id:2259610406 --> @KangBuilds commented on GitHub (Jul 31, 2024): Same problem here (v0.3.10, GPT-4o)
Author
Owner

@tjbck commented on GitHub (Jul 31, 2024):

Unable to reproduce the issue unfortunately :/ I'd greatly appreciate if anyone could provide a way to reproduce reliably!

<!-- gh-comment-id:2260208133 --> @tjbck commented on GitHub (Jul 31, 2024): Unable to reproduce the issue unfortunately :/ I'd greatly appreciate if anyone could provide a way to reproduce reliably!
Author
Owner

@JKratto commented on GitHub (Jul 31, 2024):

@tjbck I have torn down the container and redeployed it (uptime 4 days). Now, it behaves as expected. If the issue appears again, I will try to dig deeper into the logs (enabled DEBUG logging). Keep you posted.

TLDR: restarting the container seems to workaround the issue.

<!-- gh-comment-id:2260259304 --> @JKratto commented on GitHub (Jul 31, 2024): @tjbck I have torn down the container and redeployed it (uptime 4 days). Now, it behaves as expected. If the issue appears again, I will try to dig deeper into the logs (enabled DEBUG logging). Keep you posted. TLDR: restarting the container seems to workaround the issue.
Author
Owner

@beastech commented on GitHub (Jul 31, 2024):

Also happens when using pipeline to external LLM.

Here are the logs from when I send the first message.

2024-07-31 09:01:25 ERROR: Exception in ASGI application
2024-07-31 09:01:25 + Exception Group Traceback (most recent call last):
2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/_utils.py", line 87, in collapse_excgroups
2024-07-31 09:01:25 | yield
2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 190, in call
2024-07-31 09:01:25 | async with anyio.create_task_group() as task_group:
2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 680, in aexit
2024-07-31 09:01:25 | raise BaseExceptionGroup(
2024-07-31 09:01:25 | ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception)
2024-07-31 09:01:25 +-+---------------- 1 ----------------
2024-07-31 09:01:25 | Traceback (most recent call last):
2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/uvicorn/protocols/http/httptools_impl.py", line 435, in run_asgi
2024-07-31 09:01:25 | result = await app( # type: ignore[func-returns-value]
2024-07-31 09:01:25 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/uvicorn/middleware/proxy_headers.py", line 78, in call
2024-07-31 09:01:25 | return await self.app(scope, receive, send)
2024-07-31 09:01:25 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/fastapi/applications.py", line 1054, in call
2024-07-31 09:01:25 | await super().call(scope, receive, send)
2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/applications.py", line 123, in call
2024-07-31 09:01:25 | await self.middleware_stack(scope, receive, send)
2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/errors.py", line 186, in call
2024-07-31 09:01:25 | raise exc
2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/errors.py", line 164, in call
2024-07-31 09:01:25 | await self.app(scope, receive, _send)
2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 189, in call
2024-07-31 09:01:25 | with collapse_excgroups():
2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/contextlib.py", line 158, in exit
2024-07-31 09:01:25 | self.gen.throw(typ, value, traceback)
2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/_utils.py", line 93, in collapse_excgroups
2024-07-31 09:01:25 | raise exc
2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 191, in call
2024-07-31 09:01:25 | response = await self.dispatch_func(request, call_next)
2024-07-31 09:01:25 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-07-31 09:01:25 | File "/app/backend/main.py", line 915, in update_embedding_function
2024-07-31 09:01:25 | response = await call_next(request)
2024-07-31 09:01:25 | ^^^^^^^^^^^^^^^^^^^^^^^^
2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 165, in call_next
2024-07-31 09:01:25 | raise app_exc
2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 151, in coro
2024-07-31 09:01:25 | await self.app(scope, receive_or_disconnect, send_no_error)
2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 189, in call
2024-07-31 09:01:25 | with collapse_excgroups():
2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/contextlib.py", line 158, in exit
2024-07-31 09:01:25 | self.gen.throw(typ, value, traceback)
2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/_utils.py", line 93, in collapse_excgroups
2024-07-31 09:01:25 | raise exc
2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 191, in call
2024-07-31 09:01:25 | response = await self.dispatch_func(request, call_next)
2024-07-31 09:01:25 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-07-31 09:01:25 | File "/app/backend/main.py", line 906, in check_url
2024-07-31 09:01:25 | response = await call_next(request)
2024-07-31 09:01:25 | ^^^^^^^^^^^^^^^^^^^^^^^^
2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 165, in call_next
2024-07-31 09:01:25 | raise app_exc
2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 151, in coro
2024-07-31 09:01:25 | await self.app(scope, receive_or_disconnect, send_no_error)
2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 189, in call
2024-07-31 09:01:25 | with collapse_excgroups():
2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/contextlib.py", line 158, in exit
2024-07-31 09:01:25 | self.gen.throw(typ, value, traceback)
2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/_utils.py", line 93, in collapse_excgroups
2024-07-31 09:01:25 | raise exc
2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 191, in call
2024-07-31 09:01:25 | response = await self.dispatch_func(request, call_next)
2024-07-31 09:01:25 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-07-31 09:01:25 | File "/app/backend/main.py", line 892, in commit_session_after_request
2024-07-31 09:01:25 | response = await call_next(request)
2024-07-31 09:01:25 | ^^^^^^^^^^^^^^^^^^^^^^^^
2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 165, in call_next
2024-07-31 09:01:25 | raise app_exc
2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 151, in coro
2024-07-31 09:01:25 | await self.app(scope, receive_or_disconnect, send_no_error)
2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/cors.py", line 93, in call
2024-07-31 09:01:25 | await self.simple_response(scope, receive, send, request_headers=headers)
2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/cors.py", line 148, in simple_response
2024-07-31 09:01:25 | await self.app(scope, receive, send)
2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 189, in call
2024-07-31 09:01:25 | with collapse_excgroups():
2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/contextlib.py", line 158, in exit
2024-07-31 09:01:25 | self.gen.throw(typ, value, traceback)
2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/_utils.py", line 93, in collapse_excgroups
2024-07-31 09:01:25 | raise exc
2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 191, in call
2024-07-31 09:01:25 | response = await self.dispatch_func(request, call_next)
2024-07-31 09:01:25 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-07-31 09:01:25 | File "/app/backend/main.py", line 871, in dispatch
2024-07-31 09:01:25 | response = await call_next(request)
2024-07-31 09:01:25 | ^^^^^^^^^^^^^^^^^^^^^^^^
2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 165, in call_next
2024-07-31 09:01:25 | raise app_exc
2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 151, in coro
2024-07-31 09:01:25 | await self.app(scope, receive_or_disconnect, send_no_error)
2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 189, in call
2024-07-31 09:01:25 | with collapse_excgroups():
2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/contextlib.py", line 158, in exit
2024-07-31 09:01:25 | self.gen.throw(typ, value, traceback)
2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/_utils.py", line 93, in collapse_excgroups
2024-07-31 09:01:25 | raise exc
2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 191, in call
2024-07-31 09:01:25 | response = await self.dispatch_func(request, call_next)
2024-07-31 09:01:25 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-07-31 09:01:25 | File "/app/backend/main.py", line 738, in dispatch
2024-07-31 09:01:25 | response = await call_next(request)
2024-07-31 09:01:25 | ^^^^^^^^^^^^^^^^^^^^^^^^
2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 165, in call_next
2024-07-31 09:01:25 | raise app_exc
2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 151, in coro
2024-07-31 09:01:25 | await self.app(scope, receive_or_disconnect, send_no_error)
2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 65, in call
2024-07-31 09:01:25 | await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
2024-07-31 09:01:25 | raise exc
2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
2024-07-31 09:01:25 | await app(scope, receive, sender)
2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 756, in call
2024-07-31 09:01:25 | await self.middleware_stack(scope, receive, send)
2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 776, in app
2024-07-31 09:01:25 | await route.handle(scope, receive, send)
2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 297, in handle
2024-07-31 09:01:25 | await self.app(scope, receive, send)
2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 77, in app
2024-07-31 09:01:25 | await wrap_app_handling_exceptions(app, request)(scope, receive, send)
2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
2024-07-31 09:01:25 | raise exc
2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
2024-07-31 09:01:25 | await app(scope, receive, sender)
2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 72, in app
2024-07-31 09:01:25 | response = await func(request)
2024-07-31 09:01:25 | ^^^^^^^^^^^^^^^^^^^
2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 278, in app
2024-07-31 09:01:25 | raw_response = await run_endpoint_function(
2024-07-31 09:01:25 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 191, in run_endpoint_function
2024-07-31 09:01:25 | return await dependant.call(**values)
2024-07-31 09:01:25 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-07-31 09:01:25 | File "/app/backend/main.py", line 1178, in chat_completed
2024-07-31 09:01:25 | "session_id": data["session_id"],
2024-07-31 09:01:25 | ~~~~^^^^^^^^^^^^^^
2024-07-31 09:01:25 | KeyError: 'session_id'
2024-07-31 09:01:25 +------------------------------------
2024-07-31 09:01:25
2024-07-31 09:01:25 During handling of the above exception, another exception occurred:
2024-07-31 09:01:25
2024-07-31 09:01:25 Traceback (most recent call last):
2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/uvicorn/protocols/http/httptools_impl.py", line 435, in run_asgi
2024-07-31 09:01:25 result = await app( # type: ignore[func-returns-value]
2024-07-31 09:01:25 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/uvicorn/middleware/proxy_headers.py", line 78, in call
2024-07-31 09:01:25 return await self.app(scope, receive, send)
2024-07-31 09:01:25 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/fastapi/applications.py", line 1054, in call
2024-07-31 09:01:25 await super().call(scope, receive, send)
2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/applications.py", line 123, in call
2024-07-31 09:01:25 await self.middleware_stack(scope, receive, send)
2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/errors.py", line 186, in call
2024-07-31 09:01:25 raise exc
2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/errors.py", line 164, in call
2024-07-31 09:01:25 await self.app(scope, receive, _send)
2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 189, in call
2024-07-31 09:01:25 with collapse_excgroups():
2024-07-31 09:01:25 File "/usr/local/lib/python3.11/contextlib.py", line 158, in exit
2024-07-31 09:01:25 self.gen.throw(typ, value, traceback)
2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/_utils.py", line 93, in collapse_excgroups
2024-07-31 09:01:25 raise exc
2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 191, in call
2024-07-31 09:01:25 response = await self.dispatch_func(request, call_next)
2024-07-31 09:01:25 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-07-31 09:01:25 File "/app/backend/main.py", line 915, in update_embedding_function
2024-07-31 09:01:25 response = await call_next(request)
2024-07-31 09:01:25 ^^^^^^^^^^^^^^^^^^^^^^^^
2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 165, in call_next
2024-07-31 09:01:25 raise app_exc
2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 151, in coro
2024-07-31 09:01:25 await self.app(scope, receive_or_disconnect, send_no_error)
2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 189, in call
2024-07-31 09:01:25 with collapse_excgroups():
2024-07-31 09:01:25 File "/usr/local/lib/python3.11/contextlib.py", line 158, in exit
2024-07-31 09:01:25 self.gen.throw(typ, value, traceback)
2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/_utils.py", line 93, in collapse_excgroups
2024-07-31 09:01:25 raise exc
2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 191, in call
2024-07-31 09:01:25 response = await self.dispatch_func(request, call_next)
2024-07-31 09:01:25 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-07-31 09:01:25 File "/app/backend/main.py", line 906, in check_url
2024-07-31 09:01:25 response = await call_next(request)
2024-07-31 09:01:25 ^^^^^^^^^^^^^^^^^^^^^^^^
2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 165, in call_next
2024-07-31 09:01:25 raise app_exc
2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 151, in coro
2024-07-31 09:01:25 await self.app(scope, receive_or_disconnect, send_no_error)
2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 189, in call
2024-07-31 09:01:25 with collapse_excgroups():
2024-07-31 09:01:25 File "/usr/local/lib/python3.11/contextlib.py", line 158, in exit
2024-07-31 09:01:25 self.gen.throw(typ, value, traceback)
2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/_utils.py", line 93, in collapse_excgroups
2024-07-31 09:01:25 raise exc
2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 191, in call
2024-07-31 09:01:25 response = await self.dispatch_func(request, call_next)
2024-07-31 09:01:25 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-07-31 09:01:25 File "/app/backend/main.py", line 892, in commit_session_after_request
2024-07-31 09:01:25 response = await call_next(request)
2024-07-31 09:01:25 ^^^^^^^^^^^^^^^^^^^^^^^^
2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 165, in call_next
2024-07-31 09:01:25 raise app_exc
2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 151, in coro
2024-07-31 09:01:25 await self.app(scope, receive_or_disconnect, send_no_error)
2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/cors.py", line 93, in call
2024-07-31 09:01:25 await self.simple_response(scope, receive, send, request_headers=headers)
2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/cors.py", line 148, in simple_response
2024-07-31 09:01:25 await self.app(scope, receive, send)
2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 189, in call
2024-07-31 09:01:25 with collapse_excgroups():
2024-07-31 09:01:25 File "/usr/local/lib/python3.11/contextlib.py", line 158, in exit
2024-07-31 09:01:25 self.gen.throw(typ, value, traceback)
2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/_utils.py", line 93, in collapse_excgroups
2024-07-31 09:01:25 raise exc
2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 191, in call
2024-07-31 09:01:25 response = await self.dispatch_func(request, call_next)
2024-07-31 09:01:25 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-07-31 09:01:25 File "/app/backend/main.py", line 871, in dispatch
2024-07-31 09:01:25 response = await call_next(request)
2024-07-31 09:01:25 ^^^^^^^^^^^^^^^^^^^^^^^^
2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 165, in call_next
2024-07-31 09:01:25 raise app_exc
2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 151, in coro
2024-07-31 09:01:25 await self.app(scope, receive_or_disconnect, send_no_error)
2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 189, in call
2024-07-31 09:01:25 with collapse_excgroups():
2024-07-31 09:01:25 File "/usr/local/lib/python3.11/contextlib.py", line 158, in exit
2024-07-31 09:01:25 self.gen.throw(typ, value, traceback)
2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/_utils.py", line 93, in collapse_excgroups
2024-07-31 09:01:25 raise exc
2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 191, in call
2024-07-31 09:01:25 response = await self.dispatch_func(request, call_next)
2024-07-31 09:01:25 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-07-31 09:01:25 File "/app/backend/main.py", line 738, in dispatch
2024-07-31 09:01:25 response = await call_next(request)
2024-07-31 09:01:25 ^^^^^^^^^^^^^^^^^^^^^^^^
2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 165, in call_next
2024-07-31 09:01:25 raise app_exc
2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 151, in coro
2024-07-31 09:01:25 await self.app(scope, receive_or_disconnect, send_no_error)
2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 65, in call
2024-07-31 09:01:25 await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
2024-07-31 09:01:25 raise exc
2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
2024-07-31 09:01:25 await app(scope, receive, sender)
2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 756, in call
2024-07-31 09:01:25 await self.middleware_stack(scope, receive, send)
2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 776, in app
2024-07-31 09:01:25 await route.handle(scope, receive, send)
2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 297, in handle
2024-07-31 09:01:25 await self.app(scope, receive, send)
2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 77, in app
2024-07-31 09:01:25 await wrap_app_handling_exceptions(app, request)(scope, receive, send)
2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
2024-07-31 09:01:25 raise exc
2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
2024-07-31 09:01:25 await app(scope, receive, sender)
2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 72, in app
2024-07-31 09:01:25 response = await func(request)
2024-07-31 09:01:25 ^^^^^^^^^^^^^^^^^^^
2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 278, in app
2024-07-31 09:01:25 raw_response = await run_endpoint_function(
2024-07-31 09:01:25 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 191, in run_endpoint_function
2024-07-31 09:01:25 return await dependant.call(**values)
2024-07-31 09:01:25 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-07-31 09:01:25 File "/app/backend/main.py", line 1178, in chat_completed
2024-07-31 09:01:25 "session_id": data["session_id"],
2024-07-31 09:01:25 ~~~~^^^^^^^^^^^^^^
2024-07-31 09:01:25 KeyError: 'session_id'

Here are logs from when I try to send a follow up message.

2024-07-31 08:56:58 File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
2024-07-31 08:56:58 raise exc
2024-07-31 08:56:58 File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
2024-07-31 08:56:58 await app(scope, receive, sender)
2024-07-31 08:56:58 File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 72, in app
2024-07-31 08:56:58 response = await func(request)
2024-07-31 08:56:58 ^^^^^^^^^^^^^^^^^^^
2024-07-31 08:56:58 File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 278, in app
2024-07-31 08:56:58 raw_response = await run_endpoint_function(
2024-07-31 08:56:58 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-07-31 08:56:58 File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 191, in run_endpoint_function
2024-07-31 08:56:58 return await dependant.call(**values)
2024-07-31 08:56:58 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-07-31 08:56:58 File "/app/backend/main.py", line 1178, in chat_completed
2024-07-31 08:56:58 "session_id": data["session_id"],
2024-07-31 08:56:58 ~~~~^^^^^^^^^^^^^^
2024-07-31 08:56:58 KeyError: 'session_id'

<!-- gh-comment-id:2260469230 --> @beastech commented on GitHub (Jul 31, 2024): Also happens when using pipeline to external LLM. **Here are the logs from when I send the first message.** 2024-07-31 09:01:25 ERROR: Exception in ASGI application 2024-07-31 09:01:25 + Exception Group Traceback (most recent call last): 2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/_utils.py", line 87, in collapse_excgroups 2024-07-31 09:01:25 | yield 2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 190, in __call__ 2024-07-31 09:01:25 | async with anyio.create_task_group() as task_group: 2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 680, in __aexit__ 2024-07-31 09:01:25 | raise BaseExceptionGroup( 2024-07-31 09:01:25 | ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception) 2024-07-31 09:01:25 +-+---------------- 1 ---------------- 2024-07-31 09:01:25 | Traceback (most recent call last): 2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/uvicorn/protocols/http/httptools_impl.py", line 435, in run_asgi 2024-07-31 09:01:25 | result = await app( # type: ignore[func-returns-value] 2024-07-31 09:01:25 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/uvicorn/middleware/proxy_headers.py", line 78, in __call__ 2024-07-31 09:01:25 | return await self.app(scope, receive, send) 2024-07-31 09:01:25 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/fastapi/applications.py", line 1054, in __call__ 2024-07-31 09:01:25 | await super().__call__(scope, receive, send) 2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/applications.py", line 123, in __call__ 2024-07-31 09:01:25 | await self.middleware_stack(scope, receive, send) 2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/errors.py", line 186, in __call__ 2024-07-31 09:01:25 | raise exc 2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/errors.py", line 164, in __call__ 2024-07-31 09:01:25 | await self.app(scope, receive, _send) 2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 189, in __call__ 2024-07-31 09:01:25 | with collapse_excgroups(): 2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/contextlib.py", line 158, in __exit__ 2024-07-31 09:01:25 | self.gen.throw(typ, value, traceback) 2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/_utils.py", line 93, in collapse_excgroups 2024-07-31 09:01:25 | raise exc 2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 191, in __call__ 2024-07-31 09:01:25 | response = await self.dispatch_func(request, call_next) 2024-07-31 09:01:25 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-07-31 09:01:25 | File "/app/backend/main.py", line 915, in update_embedding_function 2024-07-31 09:01:25 | response = await call_next(request) 2024-07-31 09:01:25 | ^^^^^^^^^^^^^^^^^^^^^^^^ 2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 165, in call_next 2024-07-31 09:01:25 | raise app_exc 2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 151, in coro 2024-07-31 09:01:25 | await self.app(scope, receive_or_disconnect, send_no_error) 2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 189, in __call__ 2024-07-31 09:01:25 | with collapse_excgroups(): 2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/contextlib.py", line 158, in __exit__ 2024-07-31 09:01:25 | self.gen.throw(typ, value, traceback) 2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/_utils.py", line 93, in collapse_excgroups 2024-07-31 09:01:25 | raise exc 2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 191, in __call__ 2024-07-31 09:01:25 | response = await self.dispatch_func(request, call_next) 2024-07-31 09:01:25 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-07-31 09:01:25 | File "/app/backend/main.py", line 906, in check_url 2024-07-31 09:01:25 | response = await call_next(request) 2024-07-31 09:01:25 | ^^^^^^^^^^^^^^^^^^^^^^^^ 2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 165, in call_next 2024-07-31 09:01:25 | raise app_exc 2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 151, in coro 2024-07-31 09:01:25 | await self.app(scope, receive_or_disconnect, send_no_error) 2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 189, in __call__ 2024-07-31 09:01:25 | with collapse_excgroups(): 2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/contextlib.py", line 158, in __exit__ 2024-07-31 09:01:25 | self.gen.throw(typ, value, traceback) 2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/_utils.py", line 93, in collapse_excgroups 2024-07-31 09:01:25 | raise exc 2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 191, in __call__ 2024-07-31 09:01:25 | response = await self.dispatch_func(request, call_next) 2024-07-31 09:01:25 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-07-31 09:01:25 | File "/app/backend/main.py", line 892, in commit_session_after_request 2024-07-31 09:01:25 | response = await call_next(request) 2024-07-31 09:01:25 | ^^^^^^^^^^^^^^^^^^^^^^^^ 2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 165, in call_next 2024-07-31 09:01:25 | raise app_exc 2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 151, in coro 2024-07-31 09:01:25 | await self.app(scope, receive_or_disconnect, send_no_error) 2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/cors.py", line 93, in __call__ 2024-07-31 09:01:25 | await self.simple_response(scope, receive, send, request_headers=headers) 2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/cors.py", line 148, in simple_response 2024-07-31 09:01:25 | await self.app(scope, receive, send) 2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 189, in __call__ 2024-07-31 09:01:25 | with collapse_excgroups(): 2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/contextlib.py", line 158, in __exit__ 2024-07-31 09:01:25 | self.gen.throw(typ, value, traceback) 2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/_utils.py", line 93, in collapse_excgroups 2024-07-31 09:01:25 | raise exc 2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 191, in __call__ 2024-07-31 09:01:25 | response = await self.dispatch_func(request, call_next) 2024-07-31 09:01:25 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-07-31 09:01:25 | File "/app/backend/main.py", line 871, in dispatch 2024-07-31 09:01:25 | response = await call_next(request) 2024-07-31 09:01:25 | ^^^^^^^^^^^^^^^^^^^^^^^^ 2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 165, in call_next 2024-07-31 09:01:25 | raise app_exc 2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 151, in coro 2024-07-31 09:01:25 | await self.app(scope, receive_or_disconnect, send_no_error) 2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 189, in __call__ 2024-07-31 09:01:25 | with collapse_excgroups(): 2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/contextlib.py", line 158, in __exit__ 2024-07-31 09:01:25 | self.gen.throw(typ, value, traceback) 2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/_utils.py", line 93, in collapse_excgroups 2024-07-31 09:01:25 | raise exc 2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 191, in __call__ 2024-07-31 09:01:25 | response = await self.dispatch_func(request, call_next) 2024-07-31 09:01:25 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-07-31 09:01:25 | File "/app/backend/main.py", line 738, in dispatch 2024-07-31 09:01:25 | response = await call_next(request) 2024-07-31 09:01:25 | ^^^^^^^^^^^^^^^^^^^^^^^^ 2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 165, in call_next 2024-07-31 09:01:25 | raise app_exc 2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 151, in coro 2024-07-31 09:01:25 | await self.app(scope, receive_or_disconnect, send_no_error) 2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 65, in __call__ 2024-07-31 09:01:25 | await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) 2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app 2024-07-31 09:01:25 | raise exc 2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app 2024-07-31 09:01:25 | await app(scope, receive, sender) 2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 756, in __call__ 2024-07-31 09:01:25 | await self.middleware_stack(scope, receive, send) 2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 776, in app 2024-07-31 09:01:25 | await route.handle(scope, receive, send) 2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 297, in handle 2024-07-31 09:01:25 | await self.app(scope, receive, send) 2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 77, in app 2024-07-31 09:01:25 | await wrap_app_handling_exceptions(app, request)(scope, receive, send) 2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app 2024-07-31 09:01:25 | raise exc 2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app 2024-07-31 09:01:25 | await app(scope, receive, sender) 2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 72, in app 2024-07-31 09:01:25 | response = await func(request) 2024-07-31 09:01:25 | ^^^^^^^^^^^^^^^^^^^ 2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 278, in app 2024-07-31 09:01:25 | raw_response = await run_endpoint_function( 2024-07-31 09:01:25 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-07-31 09:01:25 | File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 191, in run_endpoint_function 2024-07-31 09:01:25 | return await dependant.call(**values) 2024-07-31 09:01:25 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-07-31 09:01:25 | File "/app/backend/main.py", line 1178, in chat_completed 2024-07-31 09:01:25 | "session_id": data["session_id"], 2024-07-31 09:01:25 | ~~~~^^^^^^^^^^^^^^ 2024-07-31 09:01:25 | KeyError: 'session_id' 2024-07-31 09:01:25 +------------------------------------ 2024-07-31 09:01:25 2024-07-31 09:01:25 During handling of the above exception, another exception occurred: 2024-07-31 09:01:25 2024-07-31 09:01:25 Traceback (most recent call last): 2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/uvicorn/protocols/http/httptools_impl.py", line 435, in run_asgi 2024-07-31 09:01:25 result = await app( # type: ignore[func-returns-value] 2024-07-31 09:01:25 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/uvicorn/middleware/proxy_headers.py", line 78, in __call__ 2024-07-31 09:01:25 return await self.app(scope, receive, send) 2024-07-31 09:01:25 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/fastapi/applications.py", line 1054, in __call__ 2024-07-31 09:01:25 await super().__call__(scope, receive, send) 2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/applications.py", line 123, in __call__ 2024-07-31 09:01:25 await self.middleware_stack(scope, receive, send) 2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/errors.py", line 186, in __call__ 2024-07-31 09:01:25 raise exc 2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/errors.py", line 164, in __call__ 2024-07-31 09:01:25 await self.app(scope, receive, _send) 2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 189, in __call__ 2024-07-31 09:01:25 with collapse_excgroups(): 2024-07-31 09:01:25 File "/usr/local/lib/python3.11/contextlib.py", line 158, in __exit__ 2024-07-31 09:01:25 self.gen.throw(typ, value, traceback) 2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/_utils.py", line 93, in collapse_excgroups 2024-07-31 09:01:25 raise exc 2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 191, in __call__ 2024-07-31 09:01:25 response = await self.dispatch_func(request, call_next) 2024-07-31 09:01:25 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-07-31 09:01:25 File "/app/backend/main.py", line 915, in update_embedding_function 2024-07-31 09:01:25 response = await call_next(request) 2024-07-31 09:01:25 ^^^^^^^^^^^^^^^^^^^^^^^^ 2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 165, in call_next 2024-07-31 09:01:25 raise app_exc 2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 151, in coro 2024-07-31 09:01:25 await self.app(scope, receive_or_disconnect, send_no_error) 2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 189, in __call__ 2024-07-31 09:01:25 with collapse_excgroups(): 2024-07-31 09:01:25 File "/usr/local/lib/python3.11/contextlib.py", line 158, in __exit__ 2024-07-31 09:01:25 self.gen.throw(typ, value, traceback) 2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/_utils.py", line 93, in collapse_excgroups 2024-07-31 09:01:25 raise exc 2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 191, in __call__ 2024-07-31 09:01:25 response = await self.dispatch_func(request, call_next) 2024-07-31 09:01:25 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-07-31 09:01:25 File "/app/backend/main.py", line 906, in check_url 2024-07-31 09:01:25 response = await call_next(request) 2024-07-31 09:01:25 ^^^^^^^^^^^^^^^^^^^^^^^^ 2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 165, in call_next 2024-07-31 09:01:25 raise app_exc 2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 151, in coro 2024-07-31 09:01:25 await self.app(scope, receive_or_disconnect, send_no_error) 2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 189, in __call__ 2024-07-31 09:01:25 with collapse_excgroups(): 2024-07-31 09:01:25 File "/usr/local/lib/python3.11/contextlib.py", line 158, in __exit__ 2024-07-31 09:01:25 self.gen.throw(typ, value, traceback) 2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/_utils.py", line 93, in collapse_excgroups 2024-07-31 09:01:25 raise exc 2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 191, in __call__ 2024-07-31 09:01:25 response = await self.dispatch_func(request, call_next) 2024-07-31 09:01:25 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-07-31 09:01:25 File "/app/backend/main.py", line 892, in commit_session_after_request 2024-07-31 09:01:25 response = await call_next(request) 2024-07-31 09:01:25 ^^^^^^^^^^^^^^^^^^^^^^^^ 2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 165, in call_next 2024-07-31 09:01:25 raise app_exc 2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 151, in coro 2024-07-31 09:01:25 await self.app(scope, receive_or_disconnect, send_no_error) 2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/cors.py", line 93, in __call__ 2024-07-31 09:01:25 await self.simple_response(scope, receive, send, request_headers=headers) 2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/cors.py", line 148, in simple_response 2024-07-31 09:01:25 await self.app(scope, receive, send) 2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 189, in __call__ 2024-07-31 09:01:25 with collapse_excgroups(): 2024-07-31 09:01:25 File "/usr/local/lib/python3.11/contextlib.py", line 158, in __exit__ 2024-07-31 09:01:25 self.gen.throw(typ, value, traceback) 2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/_utils.py", line 93, in collapse_excgroups 2024-07-31 09:01:25 raise exc 2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 191, in __call__ 2024-07-31 09:01:25 response = await self.dispatch_func(request, call_next) 2024-07-31 09:01:25 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-07-31 09:01:25 File "/app/backend/main.py", line 871, in dispatch 2024-07-31 09:01:25 response = await call_next(request) 2024-07-31 09:01:25 ^^^^^^^^^^^^^^^^^^^^^^^^ 2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 165, in call_next 2024-07-31 09:01:25 raise app_exc 2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 151, in coro 2024-07-31 09:01:25 await self.app(scope, receive_or_disconnect, send_no_error) 2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 189, in __call__ 2024-07-31 09:01:25 with collapse_excgroups(): 2024-07-31 09:01:25 File "/usr/local/lib/python3.11/contextlib.py", line 158, in __exit__ 2024-07-31 09:01:25 self.gen.throw(typ, value, traceback) 2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/_utils.py", line 93, in collapse_excgroups 2024-07-31 09:01:25 raise exc 2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 191, in __call__ 2024-07-31 09:01:25 response = await self.dispatch_func(request, call_next) 2024-07-31 09:01:25 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-07-31 09:01:25 File "/app/backend/main.py", line 738, in dispatch 2024-07-31 09:01:25 response = await call_next(request) 2024-07-31 09:01:25 ^^^^^^^^^^^^^^^^^^^^^^^^ 2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 165, in call_next 2024-07-31 09:01:25 raise app_exc 2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 151, in coro 2024-07-31 09:01:25 await self.app(scope, receive_or_disconnect, send_no_error) 2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 65, in __call__ 2024-07-31 09:01:25 await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) 2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app 2024-07-31 09:01:25 raise exc 2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app 2024-07-31 09:01:25 await app(scope, receive, sender) 2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 756, in __call__ 2024-07-31 09:01:25 await self.middleware_stack(scope, receive, send) 2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 776, in app 2024-07-31 09:01:25 await route.handle(scope, receive, send) 2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 297, in handle 2024-07-31 09:01:25 await self.app(scope, receive, send) 2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 77, in app 2024-07-31 09:01:25 await wrap_app_handling_exceptions(app, request)(scope, receive, send) 2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app 2024-07-31 09:01:25 raise exc 2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app 2024-07-31 09:01:25 await app(scope, receive, sender) 2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 72, in app 2024-07-31 09:01:25 response = await func(request) 2024-07-31 09:01:25 ^^^^^^^^^^^^^^^^^^^ 2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 278, in app 2024-07-31 09:01:25 raw_response = await run_endpoint_function( 2024-07-31 09:01:25 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-07-31 09:01:25 File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 191, in run_endpoint_function 2024-07-31 09:01:25 return await dependant.call(**values) 2024-07-31 09:01:25 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-07-31 09:01:25 File "/app/backend/main.py", line 1178, in chat_completed 2024-07-31 09:01:25 "session_id": data["session_id"], 2024-07-31 09:01:25 ~~~~^^^^^^^^^^^^^^ 2024-07-31 09:01:25 KeyError: 'session_id' **Here are logs from when I try to send a follow up message.** 2024-07-31 08:56:58 File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app 2024-07-31 08:56:58 raise exc 2024-07-31 08:56:58 File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app 2024-07-31 08:56:58 await app(scope, receive, sender) 2024-07-31 08:56:58 File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 72, in app 2024-07-31 08:56:58 response = await func(request) 2024-07-31 08:56:58 ^^^^^^^^^^^^^^^^^^^ 2024-07-31 08:56:58 File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 278, in app 2024-07-31 08:56:58 raw_response = await run_endpoint_function( 2024-07-31 08:56:58 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-07-31 08:56:58 File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 191, in run_endpoint_function 2024-07-31 08:56:58 return await dependant.call(**values) 2024-07-31 08:56:58 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-07-31 08:56:58 File "/app/backend/main.py", line 1178, in chat_completed 2024-07-31 08:56:58 "session_id": data["session_id"], 2024-07-31 08:56:58 ~~~~^^^^^^^^^^^^^^ 2024-07-31 08:56:58 KeyError: 'session_id'
Author
Owner

@JKratto commented on GitHub (Jul 31, 2024):

I can confirm, that I see the same behaviour/logs simply chatting with the model. This is also with a freshly (~2 hours) restarted container.
But seeing the error with the session_id it seems to me the problem is indeed in the HTTP session. Currently I observe the issue only in one of the browsers, but not in the others. So maybe some session store is getting out of sync, expiring or something like that.

Logs

ERROR:    Exception in ASGI application
  + Exception Group Traceback (most recent call last):
  |   File "/usr/local/lib/python3.11/site-packages/starlette/_utils.py", line 87, in collapse_excgroups
  |     yield
  |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 190, in __call__
  |     async with anyio.create_task_group() as task_group:
  |   File "/usr/local/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 680, in __aexit__
  |     raise BaseExceptionGroup(
  | ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception)
  +-+---------------- 1 ----------------
    | Traceback (most recent call last):
    |   File "/usr/local/lib/python3.11/site-packages/uvicorn/protocols/http/httptools_impl.py", line 435, in run_asgi
    |     result = await app(  # type: ignore[func-returns-value]
    |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |   File "/usr/local/lib/python3.11/site-packages/uvicorn/middleware/proxy_headers.py", line 78, in __call__
    |     return await self.app(scope, receive, send)
    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |   File "/usr/local/lib/python3.11/site-packages/fastapi/applications.py", line 1054, in __call__
    |     await super().__call__(scope, receive, send)
    |   File "/usr/local/lib/python3.11/site-packages/starlette/applications.py", line 123, in __call__
    |     await self.middleware_stack(scope, receive, send)
    |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/errors.py", line 186, in __call__
    |     raise exc
    |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/errors.py", line 164, in __call__
    |     await self.app(scope, receive, _send)
    |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 189, in __call__
    |     with collapse_excgroups():
    |   File "/usr/local/lib/python3.11/contextlib.py", line 158, in __exit__
    |     self.gen.throw(typ, value, traceback)
    |   File "/usr/local/lib/python3.11/site-packages/starlette/_utils.py", line 93, in collapse_excgroups
    |     raise exc
    |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 191, in __call__
    |     response = await self.dispatch_func(request, call_next)
    |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |   File "/app/backend/main.py", line 915, in update_embedding_function
    |     response = await call_next(request)
    |                ^^^^^^^^^^^^^^^^^^^^^^^^
    |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 165, in call_next
    |     raise app_exc
    |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 151, in coro
    |     await self.app(scope, receive_or_disconnect, send_no_error)
    |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 189, in __call__
    |     with collapse_excgroups():
    |   File "/usr/local/lib/python3.11/contextlib.py", line 158, in __exit__
    |     self.gen.throw(typ, value, traceback)
    |   File "/usr/local/lib/python3.11/site-packages/starlette/_utils.py", line 93, in collapse_excgroups
    |     raise exc
    |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 191, in __call__
    |     response = await self.dispatch_func(request, call_next)
    |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |   File "/app/backend/main.py", line 906, in check_url
    |     response = await call_next(request)
    |                ^^^^^^^^^^^^^^^^^^^^^^^^
    |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 165, in call_next
    |     raise app_exc
    |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 151, in coro
    |     await self.app(scope, receive_or_disconnect, send_no_error)
    |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 189, in __call__
    |     with collapse_excgroups():
    |   File "/usr/local/lib/python3.11/contextlib.py", line 158, in __exit__
    |     self.gen.throw(typ, value, traceback)
    |   File "/usr/local/lib/python3.11/site-packages/starlette/_utils.py", line 93, in collapse_excgroups
    |     raise exc
    |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 191, in __call__
    |     response = await self.dispatch_func(request, call_next)
    |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |   File "/app/backend/main.py", line 892, in commit_session_after_request
    |     response = await call_next(request)
    |                ^^^^^^^^^^^^^^^^^^^^^^^^
    |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 165, in call_next
    |     raise app_exc
    |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 151, in coro
    |     await self.app(scope, receive_or_disconnect, send_no_error)
    |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/cors.py", line 93, in __call__
    |     await self.simple_response(scope, receive, send, request_headers=headers)
    |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/cors.py", line 148, in simple_response
    |     await self.app(scope, receive, send)
    |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 189, in __call__
    |     with collapse_excgroups():
    |   File "/usr/local/lib/python3.11/contextlib.py", line 158, in __exit__
    |     self.gen.throw(typ, value, traceback)
    |   File "/usr/local/lib/python3.11/site-packages/starlette/_utils.py", line 93, in collapse_excgroups
    |     raise exc
    |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 191, in __call__
    |     response = await self.dispatch_func(request, call_next)
    |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |   File "/app/backend/main.py", line 871, in dispatch
    |     response = await call_next(request)
    |                ^^^^^^^^^^^^^^^^^^^^^^^^
    |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 165, in call_next
    |     raise app_exc
    |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 151, in coro
    |     await self.app(scope, receive_or_disconnect, send_no_error)
    |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 189, in __call__
    |     with collapse_excgroups():
    |   File "/usr/local/lib/python3.11/contextlib.py", line 158, in __exit__
    |     self.gen.throw(typ, value, traceback)
    |   File "/usr/local/lib/python3.11/site-packages/starlette/_utils.py", line 93, in collapse_excgroups
    |     raise exc
    |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 191, in __call__
    |     response = await self.dispatch_func(request, call_next)
    |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |   File "/app/backend/main.py", line 738, in dispatch
    |     response = await call_next(request)
    |                ^^^^^^^^^^^^^^^^^^^^^^^^
    |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 165, in call_next
    |     raise app_exc
    |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 151, in coro
    |     await self.app(scope, receive_or_disconnect, send_no_error)
    |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 65, in __call__
    |     await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
    |   File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
    |     raise exc
    |   File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
    |     await app(scope, receive, sender)
    |   File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 756, in __call__
    |     await self.middleware_stack(scope, receive, send)
    |   File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 776, in app
    |     await route.handle(scope, receive, send)
    |   File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 297, in handle
    |     await self.app(scope, receive, send)
    |   File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 77, in app
    |     await wrap_app_handling_exceptions(app, request)(scope, receive, send)
    |   File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
    |     raise exc
    |   File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
    |     await app(scope, receive, sender)
    |   File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 72, in app
    |     response = await func(request)
    |                ^^^^^^^^^^^^^^^^^^^
    |   File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 278, in app
    |     raw_response = await run_endpoint_function(
    |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |   File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 191, in run_endpoint_function
    |     return await dependant.call(**values)
    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |   File "/app/backend/main.py", line 1178, in chat_completed
    |     "session_id": data["session_id"],
    |                   ~~~~^^^^^^^^^^^^^^
    | KeyError: 'session_id'
    +------------------------------------

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/uvicorn/protocols/http/httptools_impl.py", line 435, in run_asgi
    result = await app(  # type: ignore[func-returns-value]
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/uvicorn/middleware/proxy_headers.py", line 78, in __call__
    return await self.app(scope, receive, send)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/fastapi/applications.py", line 1054, in __call__
    await super().__call__(scope, receive, send)
  File "/usr/local/lib/python3.11/site-packages/starlette/applications.py", line 123, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/usr/local/lib/python3.11/site-packages/starlette/middleware/errors.py", line 186, in __call__
    raise exc
  File "/usr/local/lib/python3.11/site-packages/starlette/middleware/errors.py", line 164, in __call__
    await self.app(scope, receive, _send)
  File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 189, in __call__
    with collapse_excgroups():
  File "/usr/local/lib/python3.11/contextlib.py", line 158, in __exit__
    self.gen.throw(typ, value, traceback)
  File "/usr/local/lib/python3.11/site-packages/starlette/_utils.py", line 93, in collapse_excgroups
    raise exc
  File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 191, in __call__
    response = await self.dispatch_func(request, call_next)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/backend/main.py", line 915, in update_embedding_function
    response = await call_next(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 165, in call_next
    raise app_exc
  File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 151, in coro
    await self.app(scope, receive_or_disconnect, send_no_error)
  File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 189, in __call__
    with collapse_excgroups():
  File "/usr/local/lib/python3.11/contextlib.py", line 158, in __exit__
    self.gen.throw(typ, value, traceback)
  File "/usr/local/lib/python3.11/site-packages/starlette/_utils.py", line 93, in collapse_excgroups
    raise exc
  File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 191, in __call__
    response = await self.dispatch_func(request, call_next)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/backend/main.py", line 906, in check_url
    response = await call_next(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 165, in call_next
    raise app_exc
  File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 151, in coro
    await self.app(scope, receive_or_disconnect, send_no_error)
  File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 189, in __call__
    with collapse_excgroups():
  File "/usr/local/lib/python3.11/contextlib.py", line 158, in __exit__
    self.gen.throw(typ, value, traceback)
  File "/usr/local/lib/python3.11/site-packages/starlette/_utils.py", line 93, in collapse_excgroups
    raise exc
  File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 191, in __call__
    response = await self.dispatch_func(request, call_next)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/backend/main.py", line 892, in commit_session_after_request
    response = await call_next(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 165, in call_next
INFO:     37.188.183.60:0 - "GET /ws/socket.io/?EIO=4&transport=polling&t=P48pJZI&sid=8VUFUFRONhinY28VAAAe HTTP/1.1" 200 OK
    raise app_exc
  File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 151, in coro
    await self.app(scope, receive_or_disconnect, send_no_error)
  File "/usr/local/lib/python3.11/site-packages/starlette/middleware/cors.py", line 93, in __call__
    await self.simple_response(scope, receive, send, request_headers=headers)
  File "/usr/local/lib/python3.11/site-packages/starlette/middleware/cors.py", line 148, in simple_response
    await self.app(scope, receive, send)
  File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 189, in __call__
    with collapse_excgroups():
  File "/usr/local/lib/python3.11/contextlib.py", line 158, in __exit__
    self.gen.throw(typ, value, traceback)
  File "/usr/local/lib/python3.11/site-packages/starlette/_utils.py", line 93, in collapse_excgroups
    raise exc
  File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 191, in __call__
    response = await self.dispatch_func(request, call_next)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/backend/main.py", line 871, in dispatch
    response = await call_next(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 165, in call_next
    raise app_exc
  File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 151, in coro
    await self.app(scope, receive_or_disconnect, send_no_error)
  File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 189, in __call__
    with collapse_excgroups():
  File "/usr/local/lib/python3.11/contextlib.py", line 158, in __exit__
    self.gen.throw(typ, value, traceback)
  File "/usr/local/lib/python3.11/site-packages/starlette/_utils.py", line 93, in collapse_excgroups
    raise exc
  File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 191, in __call__
    response = await self.dispatch_func(request, call_next)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/backend/main.py", line 738, in dispatch
    response = await call_next(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 165, in call_next
    raise app_exc
  File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 151, in coro
    await self.app(scope, receive_or_disconnect, send_no_error)
  File "/usr/local/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 65, in __call__
    await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
  File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
    raise exc
  File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
    await app(scope, receive, sender)
  File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 756, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 776, in app
    await route.handle(scope, receive, send)
  File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 297, in handle
    await self.app(scope, receive, send)
  File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 77, in app
    await wrap_app_handling_exceptions(app, request)(scope, receive, send)
  File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
    raise exc
  File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
    await app(scope, receive, sender)
  File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 72, in app
    response = await func(request)
               ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 278, in app
    raw_response = await run_endpoint_function(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 191, in run_endpoint_function
    return await dependant.call(**values)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/backend/main.py", line 1178, in chat_completed
    "session_id": data["session_id"],
                  ~~~~^^^^^^^^^^^^^^
KeyError: 'session_id'

<!-- gh-comment-id:2260539611 --> @JKratto commented on GitHub (Jul 31, 2024): I can confirm, that I see the same behaviour/logs simply chatting with the model. This is also with a freshly (~2 hours) restarted container. But seeing the error with the `session_id` it seems to me the problem is indeed in the HTTP session. Currently I observe the issue only in one of the browsers, but not in the others. So maybe some session store is getting out of sync, expiring or something like that. <details><summary>Logs</summary> <p> ``` ERROR: Exception in ASGI application + Exception Group Traceback (most recent call last): | File "/usr/local/lib/python3.11/site-packages/starlette/_utils.py", line 87, in collapse_excgroups | yield | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 190, in __call__ | async with anyio.create_task_group() as task_group: | File "/usr/local/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 680, in __aexit__ | raise BaseExceptionGroup( | ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception) +-+---------------- 1 ---------------- | Traceback (most recent call last): | File "/usr/local/lib/python3.11/site-packages/uvicorn/protocols/http/httptools_impl.py", line 435, in run_asgi | result = await app( # type: ignore[func-returns-value] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | File "/usr/local/lib/python3.11/site-packages/uvicorn/middleware/proxy_headers.py", line 78, in __call__ | return await self.app(scope, receive, send) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | File "/usr/local/lib/python3.11/site-packages/fastapi/applications.py", line 1054, in __call__ | await super().__call__(scope, receive, send) | File "/usr/local/lib/python3.11/site-packages/starlette/applications.py", line 123, in __call__ | await self.middleware_stack(scope, receive, send) | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/errors.py", line 186, in __call__ | raise exc | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/errors.py", line 164, in __call__ | await self.app(scope, receive, _send) | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 189, in __call__ | with collapse_excgroups(): | File "/usr/local/lib/python3.11/contextlib.py", line 158, in __exit__ | self.gen.throw(typ, value, traceback) | File "/usr/local/lib/python3.11/site-packages/starlette/_utils.py", line 93, in collapse_excgroups | raise exc | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 191, in __call__ | response = await self.dispatch_func(request, call_next) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | File "/app/backend/main.py", line 915, in update_embedding_function | response = await call_next(request) | ^^^^^^^^^^^^^^^^^^^^^^^^ | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 165, in call_next | raise app_exc | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 151, in coro | await self.app(scope, receive_or_disconnect, send_no_error) | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 189, in __call__ | with collapse_excgroups(): | File "/usr/local/lib/python3.11/contextlib.py", line 158, in __exit__ | self.gen.throw(typ, value, traceback) | File "/usr/local/lib/python3.11/site-packages/starlette/_utils.py", line 93, in collapse_excgroups | raise exc | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 191, in __call__ | response = await self.dispatch_func(request, call_next) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | File "/app/backend/main.py", line 906, in check_url | response = await call_next(request) | ^^^^^^^^^^^^^^^^^^^^^^^^ | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 165, in call_next | raise app_exc | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 151, in coro | await self.app(scope, receive_or_disconnect, send_no_error) | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 189, in __call__ | with collapse_excgroups(): | File "/usr/local/lib/python3.11/contextlib.py", line 158, in __exit__ | self.gen.throw(typ, value, traceback) | File "/usr/local/lib/python3.11/site-packages/starlette/_utils.py", line 93, in collapse_excgroups | raise exc | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 191, in __call__ | response = await self.dispatch_func(request, call_next) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | File "/app/backend/main.py", line 892, in commit_session_after_request | response = await call_next(request) | ^^^^^^^^^^^^^^^^^^^^^^^^ | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 165, in call_next | raise app_exc | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 151, in coro | await self.app(scope, receive_or_disconnect, send_no_error) | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/cors.py", line 93, in __call__ | await self.simple_response(scope, receive, send, request_headers=headers) | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/cors.py", line 148, in simple_response | await self.app(scope, receive, send) | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 189, in __call__ | with collapse_excgroups(): | File "/usr/local/lib/python3.11/contextlib.py", line 158, in __exit__ | self.gen.throw(typ, value, traceback) | File "/usr/local/lib/python3.11/site-packages/starlette/_utils.py", line 93, in collapse_excgroups | raise exc | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 191, in __call__ | response = await self.dispatch_func(request, call_next) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | File "/app/backend/main.py", line 871, in dispatch | response = await call_next(request) | ^^^^^^^^^^^^^^^^^^^^^^^^ | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 165, in call_next | raise app_exc | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 151, in coro | await self.app(scope, receive_or_disconnect, send_no_error) | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 189, in __call__ | with collapse_excgroups(): | File "/usr/local/lib/python3.11/contextlib.py", line 158, in __exit__ | self.gen.throw(typ, value, traceback) | File "/usr/local/lib/python3.11/site-packages/starlette/_utils.py", line 93, in collapse_excgroups | raise exc | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 191, in __call__ | response = await self.dispatch_func(request, call_next) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | File "/app/backend/main.py", line 738, in dispatch | response = await call_next(request) | ^^^^^^^^^^^^^^^^^^^^^^^^ | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 165, in call_next | raise app_exc | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 151, in coro | await self.app(scope, receive_or_disconnect, send_no_error) | File "/usr/local/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 65, in __call__ | await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) | File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app | raise exc | File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app | await app(scope, receive, sender) | File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 756, in __call__ | await self.middleware_stack(scope, receive, send) | File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 776, in app | await route.handle(scope, receive, send) | File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 297, in handle | await self.app(scope, receive, send) | File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 77, in app | await wrap_app_handling_exceptions(app, request)(scope, receive, send) | File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app | raise exc | File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app | await app(scope, receive, sender) | File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 72, in app | response = await func(request) | ^^^^^^^^^^^^^^^^^^^ | File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 278, in app | raw_response = await run_endpoint_function( | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 191, in run_endpoint_function | return await dependant.call(**values) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | File "/app/backend/main.py", line 1178, in chat_completed | "session_id": data["session_id"], | ~~~~^^^^^^^^^^^^^^ | KeyError: 'session_id' +------------------------------------ During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/uvicorn/protocols/http/httptools_impl.py", line 435, in run_asgi result = await app( # type: ignore[func-returns-value] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/uvicorn/middleware/proxy_headers.py", line 78, in __call__ return await self.app(scope, receive, send) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/fastapi/applications.py", line 1054, in __call__ await super().__call__(scope, receive, send) File "/usr/local/lib/python3.11/site-packages/starlette/applications.py", line 123, in __call__ await self.middleware_stack(scope, receive, send) File "/usr/local/lib/python3.11/site-packages/starlette/middleware/errors.py", line 186, in __call__ raise exc File "/usr/local/lib/python3.11/site-packages/starlette/middleware/errors.py", line 164, in __call__ await self.app(scope, receive, _send) File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 189, in __call__ with collapse_excgroups(): File "/usr/local/lib/python3.11/contextlib.py", line 158, in __exit__ self.gen.throw(typ, value, traceback) File "/usr/local/lib/python3.11/site-packages/starlette/_utils.py", line 93, in collapse_excgroups raise exc File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 191, in __call__ response = await self.dispatch_func(request, call_next) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/backend/main.py", line 915, in update_embedding_function response = await call_next(request) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 165, in call_next raise app_exc File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 151, in coro await self.app(scope, receive_or_disconnect, send_no_error) File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 189, in __call__ with collapse_excgroups(): File "/usr/local/lib/python3.11/contextlib.py", line 158, in __exit__ self.gen.throw(typ, value, traceback) File "/usr/local/lib/python3.11/site-packages/starlette/_utils.py", line 93, in collapse_excgroups raise exc File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 191, in __call__ response = await self.dispatch_func(request, call_next) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/backend/main.py", line 906, in check_url response = await call_next(request) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 165, in call_next raise app_exc File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 151, in coro await self.app(scope, receive_or_disconnect, send_no_error) File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 189, in __call__ with collapse_excgroups(): File "/usr/local/lib/python3.11/contextlib.py", line 158, in __exit__ self.gen.throw(typ, value, traceback) File "/usr/local/lib/python3.11/site-packages/starlette/_utils.py", line 93, in collapse_excgroups raise exc File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 191, in __call__ response = await self.dispatch_func(request, call_next) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/backend/main.py", line 892, in commit_session_after_request response = await call_next(request) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 165, in call_next INFO: 37.188.183.60:0 - "GET /ws/socket.io/?EIO=4&transport=polling&t=P48pJZI&sid=8VUFUFRONhinY28VAAAe HTTP/1.1" 200 OK raise app_exc File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 151, in coro await self.app(scope, receive_or_disconnect, send_no_error) File "/usr/local/lib/python3.11/site-packages/starlette/middleware/cors.py", line 93, in __call__ await self.simple_response(scope, receive, send, request_headers=headers) File "/usr/local/lib/python3.11/site-packages/starlette/middleware/cors.py", line 148, in simple_response await self.app(scope, receive, send) File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 189, in __call__ with collapse_excgroups(): File "/usr/local/lib/python3.11/contextlib.py", line 158, in __exit__ self.gen.throw(typ, value, traceback) File "/usr/local/lib/python3.11/site-packages/starlette/_utils.py", line 93, in collapse_excgroups raise exc File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 191, in __call__ response = await self.dispatch_func(request, call_next) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/backend/main.py", line 871, in dispatch response = await call_next(request) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 165, in call_next raise app_exc File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 151, in coro await self.app(scope, receive_or_disconnect, send_no_error) File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 189, in __call__ with collapse_excgroups(): File "/usr/local/lib/python3.11/contextlib.py", line 158, in __exit__ self.gen.throw(typ, value, traceback) File "/usr/local/lib/python3.11/site-packages/starlette/_utils.py", line 93, in collapse_excgroups raise exc File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 191, in __call__ response = await self.dispatch_func(request, call_next) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/backend/main.py", line 738, in dispatch response = await call_next(request) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 165, in call_next raise app_exc File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 151, in coro await self.app(scope, receive_or_disconnect, send_no_error) File "/usr/local/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 65, in __call__ await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app raise exc File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app await app(scope, receive, sender) File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 756, in __call__ await self.middleware_stack(scope, receive, send) File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 776, in app await route.handle(scope, receive, send) File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 297, in handle await self.app(scope, receive, send) File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 77, in app await wrap_app_handling_exceptions(app, request)(scope, receive, send) File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app raise exc File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app await app(scope, receive, sender) File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 72, in app response = await func(request) ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 278, in app raw_response = await run_endpoint_function( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 191, in run_endpoint_function return await dependant.call(**values) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/backend/main.py", line 1178, in chat_completed "session_id": data["session_id"], ~~~~^^^^^^^^^^^^^^ KeyError: 'session_id' ``` </p> </details>
Author
Owner

@ther0bster commented on GitHub (Jul 31, 2024):

this issue with the session_id error seems related to issue #4025, issue #4229, and issue #4161

pull request #4138 addresses this issue

To verify if this resolves your issue, test with the latest dev version / docker image (containing commit 90a6be8001)

<!-- gh-comment-id:2261068177 --> @ther0bster commented on GitHub (Jul 31, 2024): this issue with the `session_id` error seems related to issue #4025, issue #4229, and issue #4161 pull request #4138 addresses this issue To verify if this resolves your issue, test with the latest `dev` version / docker image (containing commit 90a6be8001b9835e8caf790c2597734103310121)
Author
Owner

@ticpu commented on GitHub (Aug 1, 2024):

After applying the 2 commits of this PR to "main", the issue could be reproduced and conversation with the [object Object] mention are still stuck.

   File "/home/gpt/open-webui/backend/main.py", line 1178, in chat_completed
     "session_id": data["session_id"],
                   ~~~~^^^^^^^^^^^^^^
 KeyError: 'session_id'
<!-- gh-comment-id:2261832162 --> @ticpu commented on GitHub (Aug 1, 2024): After applying the 2 commits of this PR to "main", the issue could be reproduced and conversation with the `[object Object]` mention are still stuck. ``` File "/home/gpt/open-webui/backend/main.py", line 1178, in chat_completed "session_id": data["session_id"], ~~~~^^^^^^^^^^^^^^ KeyError: 'session_id' ```
Author
Owner

@ther0bster commented on GitHub (Aug 1, 2024):

@ticpu Thanks for testing the fix! Just to confirm, did you also compile the project after applying the commits?

If you did, could you please check if there are any errors in the browser console?

The session_id crash in the backend occurs because session_id is the id of the WebSocket received from the socket.io client running in the browser, and it seems like there's an issue with the WebSocket connection causing this error.

The issue can be caused by some reverse proxy config not allowing WebSockets or by a wrong WebSocket URL that commit 90a6be8001 fixed

<!-- gh-comment-id:2262222747 --> @ther0bster commented on GitHub (Aug 1, 2024): @ticpu Thanks for testing the fix! Just to confirm, did you also compile the project after applying the commits? If you did, could you please check if there are any errors in the browser console? The `session_id` crash in the backend occurs because `session_id` is the [id of the WebSocket](https://socket.io/docs/v4/client-socket-instance/#socketid) received from the socket.io client running in the browser, and it seems like there's an issue with the WebSocket connection causing this error. The issue can be caused by some reverse proxy config not allowing WebSockets or by a wrong WebSocket URL that commit 90a6be8001b9835e8caf790c2597734103310121 fixed
Author
Owner

@JKratto commented on GitHub (Aug 1, 2024):

@ther0bster I use apache reverse proxy in front of my instance of open-webui. To be honest, I have seen those socket errors in the console for so long, and as long as everything was working properly, I did not care much. With your update, it's starting to come together. I have fixed the errors for WebSockets, and so far, it seems to be working like a charm (running still on the default 0.3.10 container image).
At this point, I feel, that there could be a mention in the docs where the proxy is being discussed. Here is my Apache vhost configuration:

Details


<IfModule mod_ssl.c>
    SSLStaplingCache shmcb:/var/run/apache2/stapling_cache(128000)
    <VirtualHost *:443>
        ServerName llm.domain.com
        ErrorLog ${APACHE_LOG_DIR}/llm.domain.com_error.log
        CustomLog ${APACHE_LOG_DIR}/llm.domain.com_access.log combined

        Protocols h2 http/1.1

        ProxyPreserveHost On
        ProxyRequests Off
        RequestHeader set X-Forwarded-For %{REMOTE_ADDR}s
        RequestHeader add X-Forwarded-Proto https

        # NEXT THREE LINES SEEM TO BE FIXING THE OBJECT OBJECT ERROR
        RewriteEngine On
        RewriteCond %{HTTP:Upgrade} =websocket [NC]
        RewriteRule /ws/(.*) ws://1.2.3.4/ws/$1 [P]

        # This fixes problems with timeouts when operating with larger files (e.g. RAG, STT etc.) 
        ProxyTimeout 600
        Timeout 600

        ProxyPass / http://1.2.3.4/ nocanon
        ProxyPassReverse / http://1.2.3.4/

        Include /etc/letsencrypt/options-ssl-apache.conf
        Header always set Strict-Transport-Security "max-age=31536000"
        SSLUseStapling on
        SSLCertificateFile /etc/letsencrypt/live/llm.domain.com/fullchain.pem
        SSLCertificateKeyFile /etc/letsencrypt/live/llm.domain.com/privkey.pem
    </VirtualHost>
</IfModule>

<!-- gh-comment-id:2262598503 --> @JKratto commented on GitHub (Aug 1, 2024): @ther0bster I use apache reverse proxy in front of my instance of open-webui. To be honest, I have seen those socket errors in the console for so long, and as long as everything was working properly, I did not care much. With your update, it's starting to come together. I have fixed the errors for WebSockets, and so far, it seems to be working like a charm (running still on the default 0.3.10 container image). At this point, I feel, that there could be a mention in the docs where the proxy is being discussed. Here is my Apache vhost configuration: <details><summary>Details</summary> <p> ``` <IfModule mod_ssl.c> SSLStaplingCache shmcb:/var/run/apache2/stapling_cache(128000) <VirtualHost *:443> ServerName llm.domain.com ErrorLog ${APACHE_LOG_DIR}/llm.domain.com_error.log CustomLog ${APACHE_LOG_DIR}/llm.domain.com_access.log combined Protocols h2 http/1.1 ProxyPreserveHost On ProxyRequests Off RequestHeader set X-Forwarded-For %{REMOTE_ADDR}s RequestHeader add X-Forwarded-Proto https # NEXT THREE LINES SEEM TO BE FIXING THE OBJECT OBJECT ERROR RewriteEngine On RewriteCond %{HTTP:Upgrade} =websocket [NC] RewriteRule /ws/(.*) ws://1.2.3.4/ws/$1 [P] # This fixes problems with timeouts when operating with larger files (e.g. RAG, STT etc.) ProxyTimeout 600 Timeout 600 ProxyPass / http://1.2.3.4/ nocanon ProxyPassReverse / http://1.2.3.4/ Include /etc/letsencrypt/options-ssl-apache.conf Header always set Strict-Transport-Security "max-age=31536000" SSLUseStapling on SSLCertificateFile /etc/letsencrypt/live/llm.domain.com/fullchain.pem SSLCertificateKeyFile /etc/letsencrypt/live/llm.domain.com/privkey.pem </VirtualHost> </IfModule> ``` </p> </details>
Author
Owner

@mbentley commented on GitHub (Aug 1, 2024):

I also have a reverse proxy, nginx in my case. There is a pretty detailed example in the nginx docs for how to configure websocket proxying but if anyone is looking for a bit of a more complete config example, here's one since I didn't see anything in the docs about nginx yet:

Details
# web socket upgrade
map $http_upgrade $connection_upgrade {
  default upgrade;
  '' close;
}

# open-webui
upstream open-webui_http {
  server 172.21.0.27:8080;
}

# open-webui
server {
  listen 443 ssl;
  http2 on;
  server_name open-webui.example.com;
  ssl_certificate_key /etc/nginx/ssl/open-webui.example.com.key;
  ssl_certificate /etc/nginx/ssl/open-webui.example.com-fullchain.cer;

  # my standard ssl settings for ciphers, etc
  include /etc/nginx/ssl.conf;

  # for larger uploads
  client_max_body_size 128M;
  client_body_timeout 300s;

  location /ws/ {
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection $connection_upgrade;

    include /etc/nginx/lb_proxy_http_to_https.conf;
    proxy_pass http://open-webui_http;
  }

  location / {
    include /etc/nginx/lb_proxy_http_to_https.conf;
    proxy_pass http://open-webui_http;
  }
}
<!-- gh-comment-id:2262621245 --> @mbentley commented on GitHub (Aug 1, 2024): I also have a reverse proxy, nginx in my case. There is a pretty [detailed example in the nginx docs](http://nginx.org/en/docs/http/websocket.html) for how to configure websocket proxying but if anyone is looking for a bit of a more complete config example, here's one since I didn't see anything in the docs about nginx yet: <details> <summary>Details</summary> ``` # web socket upgrade map $http_upgrade $connection_upgrade { default upgrade; '' close; } # open-webui upstream open-webui_http { server 172.21.0.27:8080; } # open-webui server { listen 443 ssl; http2 on; server_name open-webui.example.com; ssl_certificate_key /etc/nginx/ssl/open-webui.example.com.key; ssl_certificate /etc/nginx/ssl/open-webui.example.com-fullchain.cer; # my standard ssl settings for ciphers, etc include /etc/nginx/ssl.conf; # for larger uploads client_max_body_size 128M; client_body_timeout 300s; location /ws/ { proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; include /etc/nginx/lb_proxy_http_to_https.conf; proxy_pass http://open-webui_http; } location / { include /etc/nginx/lb_proxy_http_to_https.conf; proxy_pass http://open-webui_http; } } ``` </details>
Author
Owner

@Akira-baa commented on GitHub (Aug 1, 2024):

I have an apache reverse proxy too for https in front of open-webui.
I have the same issue

<!-- gh-comment-id:2262635254 --> @Akira-baa commented on GitHub (Aug 1, 2024): I have an apache reverse proxy too for https in front of open-webui. I have the same issue
Author
Owner

@chingwl commented on GitHub (Aug 1, 2024):

I've encountered a similar problem and may have found a solution that could help.

In my case, the issue only occurred when accessing Open WebUI remotely through a domain name, but not when accessing locally via IP. After checking the browser console logs, I noticed WebSocket connection errors.

I resolved this by modifying my Nginx configuration to properly support WebSocket connections. Here's the relevant part of my Nginx config that fixed the issue:

location / {
   proxy_pass http://127.0.0.1:8080;
   proxy_set_header Host $host;
   proxy_set_header X-Real-IP $remote_addr;
   proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
   proxy_set_header X-Forwarded-Proto $scheme;

   # WebSocket support
   proxy_http_version 1.1;
   proxy_set_header Upgrade $http_upgrade;
   proxy_set_header Connection "upgrade";
}

If you're using Nginx as a reverse proxy, you might want to try adding these WebSocket-related settings to see if it resolves the issue for you as well.

Hope this helps!

<!-- gh-comment-id:2262668457 --> @chingwl commented on GitHub (Aug 1, 2024): I've encountered a similar problem and may have found a solution that could help. In my case, the issue only occurred when accessing Open WebUI remotely through a domain name, but not when accessing locally via IP. After checking the browser console logs, I noticed WebSocket connection errors. I resolved this by modifying my Nginx configuration to properly support WebSocket connections. Here's the relevant part of my Nginx config that fixed the issue: ```conf location / { proxy_pass http://127.0.0.1:8080; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; # WebSocket support proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } ``` If you're using Nginx as a reverse proxy, you might want to try adding these WebSocket-related settings to see if it resolves the issue for you as well. Hope this helps!
Author
Owner

@ticpu commented on GitHub (Aug 1, 2024):

As with all the others, both my instances were behind reverse proxies, both Nginx.

Adding Websocket proxy seems to have fixed the issue as well:
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";

<!-- gh-comment-id:2262952199 --> @ticpu commented on GitHub (Aug 1, 2024): As with all the others, both my instances were behind reverse proxies, both Nginx. Adding Websocket proxy seems to have fixed the issue as well: proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade";
Author
Owner

@ticpu commented on GitHub (Aug 1, 2024):

At this point I feel it is more of an error message not clear issue, maybe this issue renamed to put a more appropriate error message in this situation?

<!-- gh-comment-id:2262962754 --> @ticpu commented on GitHub (Aug 1, 2024): At this point I feel it is more of an error message not clear issue, maybe this issue renamed to put a more appropriate error message in this situation?
Author
Owner

@JKratto commented on GitHub (Aug 1, 2024):

@ticpu I feel that adding some bit about this to the documentation would be beneficial. Adding three lines to the Apache proxy snippet and two lines to the nginx one would probably make it so that 90 % of the people would never experience this issue.

<!-- gh-comment-id:2263320873 --> @JKratto commented on GitHub (Aug 1, 2024): @ticpu I feel that adding some bit about this to the documentation would be beneficial. Adding three lines to the Apache proxy snippet and two lines to the nginx one would probably make it so that 90 % of the people would never experience this issue.
Author
Owner

@satlus commented on GitHub (Aug 1, 2024):

location / {
proxy_pass http://127.0.0.1:8080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;

WebSocket support

proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}


If you're using Nginx as a reverse proxy, you might want to try adding these WebSocket-related settings to see if it resolves the issue for you as well.

Hope this helps!

Thank you @chingwl , this was the fix for me and probably saved me an hour or two of debugging.

<!-- gh-comment-id:2264014401 --> @satlus commented on GitHub (Aug 1, 2024): > location / { > proxy_pass http://127.0.0.1:8080; > proxy_set_header Host $host; > proxy_set_header X-Real-IP $remote_addr; > proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; > proxy_set_header X-Forwarded-Proto $scheme; > > # WebSocket support > proxy_http_version 1.1; > proxy_set_header Upgrade $http_upgrade; > proxy_set_header Connection "upgrade"; > } > ``` > > If you're using Nginx as a reverse proxy, you might want to try adding these WebSocket-related settings to see if it resolves the issue for you as well. > > Hope this helps! Thank you @chingwl , this was the fix for me and probably saved me an hour or two of debugging.
Author
Owner

@BYTOOX commented on GitHub (Aug 2, 2024):

I've modified your config to make it Apache2 compatible, here it is :

<VirtualHost *:80>
    ServerName CHANGEME.domain.com

    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    RewriteEngine on
    RewriteCond %{SERVER_NAME} =CHANGEME.domain.com
    RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

########################################################################

<IfModule mod_ssl.c>
<VirtualHost *:443>
    ServerName CHANGEME.domain.com

    ServerAdmin webmaster@localhost

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    ProxyRequests Off
    ProxyPreserveHost On
    ProxyAddHeaders On
    SSLProxyEngine On

    # ProxyPass et ProxyPassReverse
    ProxyPass / http://CHANGEME.internal:8080/ nocanon
    ProxyPassReverse / http://CHANGEME.internal:8080/

    # Support WebSocket
    RewriteEngine On
    RewriteCond %{HTTP:Upgrade} =websocket [NC]
    RewriteRule /(.*) ws://CHANGEME.internal:8080/$1 [P,L]
    RewriteCond %{HTTP:Upgrade} !=websocket [NC]
    RewriteRule /(.*) http://CHANGEME.internal:8080/$1 [P,L]

    # Headers configuration using SetEnvIf
    SetEnvIf Remote_Addr "(.*)" X_REAL_IP=$1
    RequestHeader set X-Real-IP "%{X_REAL_IP}e"

    RequestHeader append X-Forwarded-For "%{X_REAL_IP}e"

    RequestHeader set X-Forwarded-Proto "https"

    # Specific location configurations
    <Location "/CHANGEME/api">
        ProxyPass http://CHANGEME.internal2:12345/api nocanon
        ProxyPassReverse http://CHANGEME.internal2:12345/api/
    </Location>
    
    <Location "/api/v1">
        ProxyPass http://CHANGEME.internal:8080/api/v1 nocanon
        ProxyPassReverse http://CHANGEME.internal:8080/api/v1
    </Location>

    SSLCertificateFile /etc/ssl/CHANGEME/CHANGEME.crt
    SSLCertificateKeyFile /etc/ssl/CHANGEME/CHANGEME.key
    Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>

I've not encountered the Object error bug since :D

Here is the module you need to activate :

sudo a2enmod proxy
sudo a2enmod proxy_http
sudo a2enmod proxy_wstunnel
sudo a2enmod headers
sudo a2enmod rewrite
sudo a2enmod setenvif
sudo a2enmod ssl

<!-- gh-comment-id:2264725836 --> @BYTOOX commented on GitHub (Aug 2, 2024): I've modified your config to make it Apache2 compatible, here it is : ``` <VirtualHost *:80> ServerName CHANGEME.domain.com ServerAdmin webmaster@localhost DocumentRoot /var/www/html ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined RewriteEngine on RewriteCond %{SERVER_NAME} =CHANGEME.domain.com RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent] </VirtualHost> ######################################################################## <IfModule mod_ssl.c> <VirtualHost *:443> ServerName CHANGEME.domain.com ServerAdmin webmaster@localhost ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined ProxyRequests Off ProxyPreserveHost On ProxyAddHeaders On SSLProxyEngine On # ProxyPass et ProxyPassReverse ProxyPass / http://CHANGEME.internal:8080/ nocanon ProxyPassReverse / http://CHANGEME.internal:8080/ # Support WebSocket RewriteEngine On RewriteCond %{HTTP:Upgrade} =websocket [NC] RewriteRule /(.*) ws://CHANGEME.internal:8080/$1 [P,L] RewriteCond %{HTTP:Upgrade} !=websocket [NC] RewriteRule /(.*) http://CHANGEME.internal:8080/$1 [P,L] # Headers configuration using SetEnvIf SetEnvIf Remote_Addr "(.*)" X_REAL_IP=$1 RequestHeader set X-Real-IP "%{X_REAL_IP}e" RequestHeader append X-Forwarded-For "%{X_REAL_IP}e" RequestHeader set X-Forwarded-Proto "https" # Specific location configurations <Location "/CHANGEME/api"> ProxyPass http://CHANGEME.internal2:12345/api nocanon ProxyPassReverse http://CHANGEME.internal2:12345/api/ </Location> <Location "/api/v1"> ProxyPass http://CHANGEME.internal:8080/api/v1 nocanon ProxyPassReverse http://CHANGEME.internal:8080/api/v1 </Location> SSLCertificateFile /etc/ssl/CHANGEME/CHANGEME.crt SSLCertificateKeyFile /etc/ssl/CHANGEME/CHANGEME.key Include /etc/letsencrypt/options-ssl-apache.conf </VirtualHost> </IfModule> ``` I've not encountered the Object error bug since :D Here is the module you need to activate : sudo a2enmod proxy sudo a2enmod proxy_http sudo a2enmod proxy_wstunnel sudo a2enmod headers sudo a2enmod rewrite sudo a2enmod setenvif sudo a2enmod ssl
Author
Owner

@fracergu commented on GitHub (Aug 2, 2024):

I am also behind a reverse-proxy (nginx-proxy-manager) and after enabling websockets support the problem seems to be solved. I've been running the same session on the same browser for more than 24h without any problem.
I agree with @JKratto that adding a few lines in the documentation about this specific case will save some headaches.

<!-- gh-comment-id:2264741884 --> @fracergu commented on GitHub (Aug 2, 2024): I am also behind a reverse-proxy (nginx-proxy-manager) and after enabling websockets support the problem seems to be solved. I've been running the same session on the same browser for more than 24h without any problem. I agree with @JKratto that adding a few lines in the documentation about this specific case will save some headaches.
Author
Owner

@schihei commented on GitHub (Aug 2, 2024):

I also can confirm that it seems the problem goes away by adding the following rules to my nginx reverse proxy configuration.

location ~/ {
	proxy_pass http://127.0.0.1:3030;
	proxy_set_header Host $host;
	proxy_set_header X-Real-IP $remote_addr;
	proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
	proxy_set_header X-Forwarded-Proto $scheme;
	proxy_set_header Connection "";
	proxy_buffering off;

	# WebSocket support
	proxy_http_version 1.1;
	proxy_set_header Upgrade $http_upgrade;
	proxy_set_header Connection "upgrade";

	client_max_body_size 0;
	proxy_read_timeout 36000s;
	proxy_redirect off;
}
<!-- gh-comment-id:2264965192 --> @schihei commented on GitHub (Aug 2, 2024): I also can confirm that it seems the problem goes away by adding the following rules to my nginx reverse proxy configuration. ``` location ~/ { proxy_pass http://127.0.0.1:3030; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header Connection ""; proxy_buffering off; # WebSocket support proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; client_max_body_size 0; proxy_read_timeout 36000s; proxy_redirect off; } ```
Author
Owner

@jtsorlinis commented on GitHub (Aug 5, 2024):

I didn't need the proxy_http_version line but adding the following 2 also fixed it for me:

proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
<!-- gh-comment-id:2267954537 --> @jtsorlinis commented on GitHub (Aug 5, 2024): I didn't need the `proxy_http_version` line but adding the following 2 also fixed it for me: ``` proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; ```
Author
Owner

@lewismacnow commented on GitHub (Aug 11, 2024):

Are there docs on how to handle websockets with a reverse proxy?

None of the configs suggested in this discussion have been successful for my configuration and without a way to disable use of Websocket traffic, OWU has been rendered completely unusable.

A way to disable websocket traffic would be highly desirable.

<!-- gh-comment-id:2282768584 --> @lewismacnow commented on GitHub (Aug 11, 2024): Are there docs on how to handle websockets with a reverse proxy? None of the configs suggested in this discussion have been successful for my configuration and without a way to disable use of Websocket traffic, OWU has been rendered completely unusable. A way to disable websocket traffic would be highly desirable.
Author
Owner

@oe3gwu commented on GitHub (Aug 11, 2024):

Same with 0.3.12 - it worked with 0.3.10 for me. But it only triggers when usint nginx as proxy before. When accessing open-webui direct, it works (for me)

Short update:

Using nginx-proxy-manager, this helped me:

proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";

Setting http version was mandatory.

<!-- gh-comment-id:2282866646 --> @oe3gwu commented on GitHub (Aug 11, 2024): Same with 0.3.12 - it worked with 0.3.10 for me. But it only triggers when usint nginx as proxy before. When accessing open-webui direct, it works (for me) Short update: Using nginx-proxy-manager, this helped me: ``` proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; ``` Setting http version was mandatory.
Author
Owner

@booyasatoshi commented on GitHub (Aug 13, 2024):

If you use Synology DSM and the built-in nginx reverse proxy, edit your entry, go to the Reverse Proxy Rules, then the Custom Headers tab and enable Web Sockets as you see below; this will solve this problem:

image
<!-- gh-comment-id:2285465734 --> @booyasatoshi commented on GitHub (Aug 13, 2024): If you use Synology DSM and the built-in nginx reverse proxy, edit your entry, go to the Reverse Proxy Rules, then the Custom Headers tab and enable Web Sockets as you see below; this will solve this problem: <img width="605" alt="image" src="https://github.com/user-attachments/assets/85a6e347-7c24-4aa9-9bea-478b1b202d4e">
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#29046