Bug: Certain documents will cause the chat to malfunction #471

Closed
opened 2025-11-11 14:22:08 -06:00 by GiteaMirror · 3 comments
Owner

Originally created by @ChanJianHao on GitHub (Mar 14, 2024).

Bug Report

Description

Bug Summary:
When uploading certain documents along with chat, the chat will not respond.

Steps to Reproduce:

  1. Upload firefox.txt to chat
  2. Send in chat "This is a Windows event logs. Were there any suspicious activities?"

Expected Behavior:
LLM should reply, as it was working in previous version.

Actual Behavior:
Chat shows loading forever. In docker, I noticed some errors.

Environment

Macos Sonoma latest

Reproduction Details

Confirmation:

  • [Y] I have read and followed all the instructions provided in the README.md.
  • [Y] I am on the latest version of both Open WebUI and Ollama.
  • [NA] I have included the browser console logs.
  • [Y] I have included the Docker container logs.

Logs and Screenshots

Browser Console Logs:

Not applicable.

Docker Container Logs:

2024-03-14 15:34:56 INFO:     192.168.65.1:53876 - "POST /api/v1/chats/new HTTP/1.1" 200 OK
2024-03-14 15:34:56 INFO:     192.168.65.1:53876 - "GET /api/v1/chats/ HTTP/1.1" 200 OK
2024-03-14 15:34:56 /ollama/api/chat
2024-03-14 15:34:56 [{'type': 'doc', 'name': 'firefox.txt', 'collection_name': '8e9e69c869b4c06aa673f61aa613334e23f75b1787e10bed19cfd1f98b043e5', 'upload_status': True, 'error': ''}]
2024-03-14 15:34:56 INFO:     192.168.65.1:53876 - "POST /ollama/api/chat HTTP/1.1" 500 Internal Server Error
2024-03-14 15:34:56 INFO:     192.168.65.1:53877 - "GET /static/favicon.png HTTP/1.1" 304 Not Modified
2024-03-14 15:34:56 ERROR:    Exception in ASGI application
2024-03-14 15:34:56 Traceback (most recent call last):
2024-03-14 15:34:56   File "/usr/local/lib/python3.11/site-packages/uvicorn/protocols/http/httptools_impl.py", line 412, in run_asgi
2024-03-14 15:34:56     result = await app(  # type: ignore[func-returns-value]
2024-03-14 15:34:56              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-03-14 15:34:56   File "/usr/local/lib/python3.11/site-packages/uvicorn/middleware/proxy_headers.py", line 69, in __call__
2024-03-14 15:34:56     return await self.app(scope, receive, send)
2024-03-14 15:34:56            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-03-14 15:34:56   File "/usr/local/lib/python3.11/site-packages/fastapi/applications.py", line 1054, in __call__
2024-03-14 15:34:56     await super().__call__(scope, receive, send)
2024-03-14 15:34:56   File "/usr/local/lib/python3.11/site-packages/starlette/applications.py", line 123, in __call__
2024-03-14 15:34:56     await self.middleware_stack(scope, receive, send)
2024-03-14 15:34:56   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/errors.py", line 186, in __call__
2024-03-14 15:34:56     raise exc
2024-03-14 15:34:56   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/errors.py", line 164, in __call__
2024-03-14 15:34:56     await self.app(scope, receive, _send)
2024-03-14 15:34:56   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 189, in __call__
2024-03-14 15:34:56     with collapse_excgroups():
2024-03-14 15:34:56   File "/usr/local/lib/python3.11/contextlib.py", line 158, in __exit__
2024-03-14 15:34:56     self.gen.throw(typ, value, traceback)
2024-03-14 15:34:56   File "/usr/local/lib/python3.11/site-packages/starlette/_utils.py", line 93, in collapse_excgroups
2024-03-14 15:34:56     raise exc
2024-03-14 15:34:56   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 191, in __call__
2024-03-14 15:34:56     response = await self.dispatch_func(request, call_next)
2024-03-14 15:34:56                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-03-14 15:34:56   File "/app/backend/main.py", line 131, in check_url
2024-03-14 15:34:56     response = await call_next(request)
2024-03-14 15:34:56                ^^^^^^^^^^^^^^^^^^^^^^^^
2024-03-14 15:34:56   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 165, in call_next
2024-03-14 15:34:56     raise app_exc
2024-03-14 15:34:56   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 151, in coro
2024-03-14 15:34:56     await self.app(scope, receive_or_disconnect, send_no_error)
2024-03-14 15:34:56   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/cors.py", line 91, in __call__
2024-03-14 15:34:56     await self.simple_response(scope, receive, send, request_headers=headers)
2024-03-14 15:34:56   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/cors.py", line 146, in simple_response
2024-03-14 15:34:56     await self.app(scope, receive, send)
2024-03-14 15:34:56   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 189, in __call__
2024-03-14 15:34:56     with collapse_excgroups():
2024-03-14 15:34:56   File "/usr/local/lib/python3.11/contextlib.py", line 158, in __exit__
2024-03-14 15:34:56     self.gen.throw(typ, value, traceback)
2024-03-14 15:34:56   File "/usr/local/lib/python3.11/site-packages/starlette/_utils.py", line 93, in collapse_excgroups
2024-03-14 15:34:56     raise exc
2024-03-14 15:34:56   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 191, in __call__
2024-03-14 15:34:56     response = await self.dispatch_func(request, call_next)
2024-03-14 15:34:56                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-03-14 15:34:56   File "/app/backend/main.py", line 83, in dispatch
2024-03-14 15:34:56     data["messages"] = rag_messages(
2024-03-14 15:34:56                        ^^^^^^^^^^^^^
2024-03-14 15:34:56   File "/app/backend/apps/rag/utils.py", line 159, in rag_messages
2024-03-14 15:34:56     ra_content = rag_template(
2024-03-14 15:34:56                  ^^^^^^^^^^^^^
2024-03-14 15:34:56   File "/app/backend/apps/rag/utils.py", line 94, in rag_template
2024-03-14 15:34:56     template = re.sub(r"\[context\]", context, template)
2024-03-14 15:34:56                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-03-14 15:34:56   File "/usr/local/lib/python3.11/re/__init__.py", line 185, in sub
2024-03-14 15:34:56     return _compile(pattern, flags).sub(repl, string, count)
2024-03-14 15:34:56            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-03-14 15:34:56   File "/usr/local/lib/python3.11/re/__init__.py", line 317, in _subx
2024-03-14 15:34:56     template = _compile_repl(template, pattern)
2024-03-14 15:34:56                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-03-14 15:34:56   File "/usr/local/lib/python3.11/re/__init__.py", line 308, in _compile_repl
2024-03-14 15:34:56     return _parser.parse_template(repl, pattern)
2024-03-14 15:34:56            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-03-14 15:34:56   File "/usr/local/lib/python3.11/re/_parser.py", line 1087, in parse_template
2024-03-14 15:34:56     raise s.error('bad escape %s' % this, len(this)) from None
2024-03-14 15:34:56 re.error: bad escape \U at position 1023 (line 29, column 32)

Screenshots (if applicable):
[Attach any relevant screenshots to help illustrate the issue]

Installation Method

via Docker

Additional Information

I have attached the file that is giving me issues. Most files would work with no issues. But I noticed certain files, like those with null bytes have to be cleaned beforehand.

I have a few file samples which are known to cause issue, the one I used is firefox.txt within the archive. The others may have issues too.

Archive.zip

Thank you in advance! :)

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 @ChanJianHao on GitHub (Mar 14, 2024). # Bug Report ## Description **Bug Summary:** When uploading certain documents along with chat, the chat will not respond. **Steps to Reproduce:** 1. Upload firefox.txt to chat 2. Send in chat "This is a Windows event logs. Were there any suspicious activities?" **Expected Behavior:** LLM should reply, as it was working in previous version. **Actual Behavior:** Chat shows loading forever. In docker, I noticed some errors. ## Environment Macos Sonoma latest ## Reproduction Details **Confirmation:** - [Y] I have read and followed all the instructions provided in the README.md. - [Y] I am on the latest version of both Open WebUI and Ollama. - [NA] I have included the browser console logs. - [Y] I have included the Docker container logs. ## Logs and Screenshots **Browser Console Logs:** Not applicable. **Docker Container Logs:** ``` 2024-03-14 15:34:56 INFO: 192.168.65.1:53876 - "POST /api/v1/chats/new HTTP/1.1" 200 OK 2024-03-14 15:34:56 INFO: 192.168.65.1:53876 - "GET /api/v1/chats/ HTTP/1.1" 200 OK 2024-03-14 15:34:56 /ollama/api/chat 2024-03-14 15:34:56 [{'type': 'doc', 'name': 'firefox.txt', 'collection_name': '8e9e69c869b4c06aa673f61aa613334e23f75b1787e10bed19cfd1f98b043e5', 'upload_status': True, 'error': ''}] 2024-03-14 15:34:56 INFO: 192.168.65.1:53876 - "POST /ollama/api/chat HTTP/1.1" 500 Internal Server Error 2024-03-14 15:34:56 INFO: 192.168.65.1:53877 - "GET /static/favicon.png HTTP/1.1" 304 Not Modified 2024-03-14 15:34:56 ERROR: Exception in ASGI application 2024-03-14 15:34:56 Traceback (most recent call last): 2024-03-14 15:34:56 File "/usr/local/lib/python3.11/site-packages/uvicorn/protocols/http/httptools_impl.py", line 412, in run_asgi 2024-03-14 15:34:56 result = await app( # type: ignore[func-returns-value] 2024-03-14 15:34:56 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-03-14 15:34:56 File "/usr/local/lib/python3.11/site-packages/uvicorn/middleware/proxy_headers.py", line 69, in __call__ 2024-03-14 15:34:56 return await self.app(scope, receive, send) 2024-03-14 15:34:56 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-03-14 15:34:56 File "/usr/local/lib/python3.11/site-packages/fastapi/applications.py", line 1054, in __call__ 2024-03-14 15:34:56 await super().__call__(scope, receive, send) 2024-03-14 15:34:56 File "/usr/local/lib/python3.11/site-packages/starlette/applications.py", line 123, in __call__ 2024-03-14 15:34:56 await self.middleware_stack(scope, receive, send) 2024-03-14 15:34:56 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/errors.py", line 186, in __call__ 2024-03-14 15:34:56 raise exc 2024-03-14 15:34:56 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/errors.py", line 164, in __call__ 2024-03-14 15:34:56 await self.app(scope, receive, _send) 2024-03-14 15:34:56 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 189, in __call__ 2024-03-14 15:34:56 with collapse_excgroups(): 2024-03-14 15:34:56 File "/usr/local/lib/python3.11/contextlib.py", line 158, in __exit__ 2024-03-14 15:34:56 self.gen.throw(typ, value, traceback) 2024-03-14 15:34:56 File "/usr/local/lib/python3.11/site-packages/starlette/_utils.py", line 93, in collapse_excgroups 2024-03-14 15:34:56 raise exc 2024-03-14 15:34:56 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 191, in __call__ 2024-03-14 15:34:56 response = await self.dispatch_func(request, call_next) 2024-03-14 15:34:56 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-03-14 15:34:56 File "/app/backend/main.py", line 131, in check_url 2024-03-14 15:34:56 response = await call_next(request) 2024-03-14 15:34:56 ^^^^^^^^^^^^^^^^^^^^^^^^ 2024-03-14 15:34:56 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 165, in call_next 2024-03-14 15:34:56 raise app_exc 2024-03-14 15:34:56 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 151, in coro 2024-03-14 15:34:56 await self.app(scope, receive_or_disconnect, send_no_error) 2024-03-14 15:34:56 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/cors.py", line 91, in __call__ 2024-03-14 15:34:56 await self.simple_response(scope, receive, send, request_headers=headers) 2024-03-14 15:34:56 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/cors.py", line 146, in simple_response 2024-03-14 15:34:56 await self.app(scope, receive, send) 2024-03-14 15:34:56 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 189, in __call__ 2024-03-14 15:34:56 with collapse_excgroups(): 2024-03-14 15:34:56 File "/usr/local/lib/python3.11/contextlib.py", line 158, in __exit__ 2024-03-14 15:34:56 self.gen.throw(typ, value, traceback) 2024-03-14 15:34:56 File "/usr/local/lib/python3.11/site-packages/starlette/_utils.py", line 93, in collapse_excgroups 2024-03-14 15:34:56 raise exc 2024-03-14 15:34:56 File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 191, in __call__ 2024-03-14 15:34:56 response = await self.dispatch_func(request, call_next) 2024-03-14 15:34:56 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-03-14 15:34:56 File "/app/backend/main.py", line 83, in dispatch 2024-03-14 15:34:56 data["messages"] = rag_messages( 2024-03-14 15:34:56 ^^^^^^^^^^^^^ 2024-03-14 15:34:56 File "/app/backend/apps/rag/utils.py", line 159, in rag_messages 2024-03-14 15:34:56 ra_content = rag_template( 2024-03-14 15:34:56 ^^^^^^^^^^^^^ 2024-03-14 15:34:56 File "/app/backend/apps/rag/utils.py", line 94, in rag_template 2024-03-14 15:34:56 template = re.sub(r"\[context\]", context, template) 2024-03-14 15:34:56 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-03-14 15:34:56 File "/usr/local/lib/python3.11/re/__init__.py", line 185, in sub 2024-03-14 15:34:56 return _compile(pattern, flags).sub(repl, string, count) 2024-03-14 15:34:56 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-03-14 15:34:56 File "/usr/local/lib/python3.11/re/__init__.py", line 317, in _subx 2024-03-14 15:34:56 template = _compile_repl(template, pattern) 2024-03-14 15:34:56 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-03-14 15:34:56 File "/usr/local/lib/python3.11/re/__init__.py", line 308, in _compile_repl 2024-03-14 15:34:56 return _parser.parse_template(repl, pattern) 2024-03-14 15:34:56 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-03-14 15:34:56 File "/usr/local/lib/python3.11/re/_parser.py", line 1087, in parse_template 2024-03-14 15:34:56 raise s.error('bad escape %s' % this, len(this)) from None 2024-03-14 15:34:56 re.error: bad escape \U at position 1023 (line 29, column 32) ``` **Screenshots (if applicable):** [Attach any relevant screenshots to help illustrate the issue] ## Installation Method via Docker ## Additional Information I have attached the file that is giving me issues. Most files would work with no issues. But I noticed certain files, like those with null bytes have to be cleaned beforehand. I have a few file samples which are known to cause issue, the one I used is firefox.txt within the archive. The others may have issues too. [Archive.zip](https://github.com/open-webui/open-webui/files/14598660/Archive.zip) Thank you in advance! :) ## 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!
Author
Owner

@tjbck commented on GitHub (Mar 15, 2024):

This issue should be solved with the latest release, keep us updated!

@tjbck commented on GitHub (Mar 15, 2024): This issue should be solved with the latest release, keep us updated!
Author
Owner

@ChanJianHao commented on GitHub (Mar 16, 2024):

This issue should be solved with the latest release, keep us updated!

Hi @tjbck, thank you for the quick fix. The issue is indeed fixed!

Some files are still having difficulties being uploaded though, likely due to non readable ASCII characters like null bytes which needs to be cleaned. Would open-webui be able to handle them in future?

Sample file which does not upload:
persist_firefox_comhijack_sysmon_11_13_7_1.txt

Error on browser:

Something went wrong :/ Error loading /app/backend/data/uploads/persist_firefox_comhijack_sysmon_11_13_7_1.txt

Docker error:

2024-03-16 14:36:17 Error loading /app/backend/data/uploads/persist_firefox_comhijack_sysmon_11_13_7_1.txt
2024-03-16 14:36:17 INFO:     49.245.19.26:0 - "POST /rag/api/v1/doc HTTP/1.1" 400 Bad Request
2024-03-16 14:38:29 text/plain
2024-03-16 14:38:29 Error loading /app/backend/data/uploads/persist_firefox_comhijack_sysmon_11_13_7_1.txt
2024-03-16 14:38:29 INFO:     49.245.19.26:0 - "POST /rag/api/v1/doc HTTP/1.1" 400 Bad Request
@ChanJianHao commented on GitHub (Mar 16, 2024): > This issue should be solved with the latest release, keep us updated! Hi @tjbck, thank you for the quick fix. The issue is indeed fixed! ⭐ Some files are still having difficulties being uploaded though, likely due to non readable ASCII characters like null bytes which needs to be cleaned. Would open-webui be able to handle them in future? Sample file which does not upload: [persist_firefox_comhijack_sysmon_11_13_7_1.txt](https://github.com/open-webui/open-webui/files/14622689/persist_firefox_comhijack_sysmon_11_13_7_1.txt) Error on browser: ``` Something went wrong :/ Error loading /app/backend/data/uploads/persist_firefox_comhijack_sysmon_11_13_7_1.txt ``` Docker error: ``` 2024-03-16 14:36:17 Error loading /app/backend/data/uploads/persist_firefox_comhijack_sysmon_11_13_7_1.txt 2024-03-16 14:36:17 INFO: 49.245.19.26:0 - "POST /rag/api/v1/doc HTTP/1.1" 400 Bad Request 2024-03-16 14:38:29 text/plain 2024-03-16 14:38:29 Error loading /app/backend/data/uploads/persist_firefox_comhijack_sysmon_11_13_7_1.txt 2024-03-16 14:38:29 INFO: 49.245.19.26:0 - "POST /rag/api/v1/doc HTTP/1.1" 400 Bad Request ```
Author
Owner

@tjbck commented on GitHub (Mar 16, 2024):

Should be fixed on the dev branch, feel free to try it out and let us know if the issue persists!

@tjbck commented on GitHub (Mar 16, 2024): Should be fixed on the dev branch, feel free to try it out and let us know if the issue persists!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#471