mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-07 03:18:23 -05:00
[GH-ISSUE #16603] issue: Uploading documents with brackets in the filename gives "'PosixPath' object is not iterable" #56639
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @RenHoekNL on GitHub (Aug 14, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/16603
Check Existing Issues
Installation Method
Docker
Open WebUI Version
v0.6.22 (latest)
Ollama Version (if applicable)
0.11.4
Operating System
Debian GNU/Linux 12 (bookworm) (docker)
Browser (if applicable)
No response
Confirmation
README.md.Expected Behavior
Expected behaviour: File is uploaded
Actual Behavior
Web browser pops up message saying: 'PosixPath' object is not iterable
The filename has brackets '[]' in it. When I copied the file, removed the backets from the name and uploaded it. It works fine.
The fact that the brackets break the code, could indicate that somewhere user-input it interpreted. A possible security issue.
Steps to Reproduce
See above.
Upload a file with brackets in the filename, e.g. "hello [world] today.txt"
Logs & Screenshots
2025-08-14 03:52:21.003 | INFO | open_webui.routers.files:upload_file:95 - file.content_type: application/epub+zip
2025-08-14 03:52:21.037 | ERROR | open_webui.routers.retrieval:process_file:1519 - 'PosixPath' object is not iterable
Traceback (most recent call last):
File "/usr/local/lib/python3.11/threading.py", line 1002, in _bootstrap
self._bootstrap_inner()
│ └ <function Thread._bootstrap_inner at 0x74d5559589a0>
└ <WorkerThread(AnyIO worker thread, started 128455081838272)>
File "/usr/local/lib/python3.11/threading.py", line 1045, in _bootstrap_inner
self.run()
│ └ <function WorkerThread.run at 0x74d4b8696d40>
└ <WorkerThread(AnyIO worker thread, started 128455081838272)>
File "/usr/local/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 967, in run
result = context.run(func, *args)
│ │ │ └ ()
│ │ └ functools.partial(<function upload_file at 0x74d509066200>, user=UserModel(id='30d5e137-ad6b-4dbf-9610-6a5a7003e898', name='r...
│ └ <method 'run' of '_contextvars.Context' objects>
└ <_contextvars.Context object at 0x74d4b8c550c0>
File "/app/backend/open_webui/routers/files.py", line 183, in upload_file
process_file(request, ProcessFileForm(file_id=id), user=user)
│ │ │ │ └ UserModel(id='30d5e137-ad6b-4dbf-9610-6a5a7003e898', name='ren', email='no@example.com', role='admin', profile_image_url='dat...
│ │ │ └ '7cbacd0c-3230-4016-8eff-c851b5103be3'
│ │ └ <class 'open_webui.routers.retrieval.ProcessFileForm'>
│ └ <starlette.requests.Request object at 0x74d4442f0f90>
└ <function process_file at 0x74d506237240>
File "/app/backend/open_webui/retrieval/loaders/main.py", line 218, in load
docs = loader.load()
│ └ <function BaseLoader.load at 0x74d5071e1440>
└ <langchain_community.document_loaders.epub.UnstructuredEPubLoader object at 0x74d4b8b378d0>
File "/usr/local/lib/python3.11/site-packages/langchain_core/document_loaders/base.py", line 32, in load
return list(self.lazy_load())
│ └ <function UnstructuredBaseLoader.lazy_load at 0x74d5071e3060>
└ <langchain_community.document_loaders.epub.UnstructuredEPubLoader object at 0x74d4b8b378d0>
File "/usr/local/lib/python3.11/site-packages/langchain_community/document_loaders/unstructured.py", line 107, in lazy_load
elements = self._get_elements()
│ └ <function UnstructuredEPubLoader._get_elements at 0x74d506d114e0>
└ <langchain_community.document_loaders.epub.UnstructuredEPubLoader object at 0x74d4b8b378d0>
File "/usr/local/lib/python3.11/site-packages/langchain_community/document_loaders/epub.py", line 55, in _get_elements
return partition_epub(filename=self.file_path, **self.unstructured_kwargs)
│ │ │ │ └ {}
│ │ │ └ <langchain_community.document_loaders.epub.UnstructuredEPubLoader object at 0x74d4b8b378d0>
│ │ └ '/app/backend/data/uploads/7cbacd0c-3230-4016-8eff-c851b5103be3_xxx - [xxx 14] - xxx (1994, H...
│ └ <langchain_community.document_loaders.epub.UnstructuredEPubLoader object at 0x74d4b8b378d0>
└ <function partition_epub at 0x74d4b82322a0>
File "/usr/local/lib/python3.11/site-packages/unstructured/partition/epub.py", line 48, in partition_epub
html_text = convert_file_to_html_text_using_pandoc(
└ <function convert_file_to_html_text_using_pandoc at 0x74d4b82c0ea0>
File "/usr/local/lib/python3.11/site-packages/unstructured/file_utils/file_conversion.py", line 67, in convert_file_to_html_text_using_pandoc
return convert_file_to_text(
└ <function convert_file_to_text at 0x74d4b82c1760>
File "/usr/local/lib/python3.11/site-packages/unstructured/utils.py", line 216, in wrapper
return func(*args, **kwargs)
│ │ └ {'filename': '/app/backend/data/uploads/7cbacd0c-3230-4016-8eff-c851b5103be3_xxx - [xxx 14] - Lords and La...
│ └ ()
└ <function convert_file_to_text at 0x74d4b82c0d60>
File "/usr/local/lib/python3.11/site-packages/unstructured/file_utils/file_conversion.py", line 17, in convert_file_to_text
text = pypandoc.convert_file(filename, target_format, format=source_format)
│ │ │ │ └ 'epub'
│ │ │ └ 'html'
│ │ └ '/app/backend/data/uploads/7cbacd0c-3230-4016-8eff-c851b5103be3_xxx - [xxx 14] - xxx (1994, H...
│ └ <function convert_file at 0x74d4445dee80>
└ <module 'pypandoc' from '/usr/local/lib/python3.11/site-packages/pypandoc/init.py'>
File "/usr/local/lib/python3.11/site-packages/pypandoc/init.py", line 206, in convert_file
return _convert_input(discovered_source_files, format, 'path', to, extra_args=extra_args,
│ │ │ │ └ ()
│ │ │ └ 'html'
│ │ └ 'epub'
│ └ PosixPath('/app/backend/data/uploads/7cbacd0c-3230-4016-8eff-c851b5103be3_xxx - [xxx 14] - xxx...
└ <function _convert_input at 0x74d4445df380>
File "/usr/local/lib/python3.11/site-packages/pypandoc/init.py", line 387, in _convert_input
input_file = sorted(input_file)
└ PosixPath('/app/backend/data/uploads/7cbacd0c-3230-4016-8eff-c851b5103be3_xxx - [xxx 14] - xxx...
TypeError: 'PosixPath' object is not iterable
2025-08-14 03:52:21.038 | ERROR | open_webui.routers.files:upload_file:192 - 400: 'PosixPath' object is not iterable
Traceback (most recent call last):
File "/app/backend/open_webui/routers/retrieval.py", line 1438, in process_file
docs = loader.load(
│ └ <function Loader.load at 0x74d506cc1b20>
└ <open_webui.retrieval.loaders.main.Loader object at 0x74d4443d2cd0>
File "/app/backend/open_webui/retrieval/loaders/main.py", line 218, in load
docs = loader.load()
│ └ <function BaseLoader.load at 0x74d5071e1440>
└ <langchain_community.document_loaders.epub.UnstructuredEPubLoader object at 0x74d4b8b378d0>
File "/usr/local/lib/python3.11/site-packages/langchain_core/document_loaders/base.py", line 32, in load
return list(self.lazy_load())
│ └ <function UnstructuredBaseLoader.lazy_load at 0x74d5071e3060>
└ <langchain_community.document_loaders.epub.UnstructuredEPubLoader object at 0x74d4b8b378d0>
File "/usr/local/lib/python3.11/site-packages/langchain_community/document_loaders/unstructured.py", line 107, in lazy_load
elements = self._get_elements()
│ └ <function UnstructuredEPubLoader._get_elements at 0x74d506d114e0>
└ <langchain_community.document_loaders.epub.UnstructuredEPubLoader object at 0x74d4b8b378d0>
File "/usr/local/lib/python3.11/site-packages/langchain_community/document_loaders/epub.py", line 55, in _get_elements
return partition_epub(filename=self.file_path, **self.unstructured_kwargs)
│ │ │ │ └ {}
│ │ │ └ <langchain_community.document_loaders.epub.UnstructuredEPubLoader object at 0x74d4b8b378d0>
│ │ └ '/app/backend/data/uploads/7cbacd0c-3230-4016-8eff-c851b5103be3_xxx - [xxx 14] - xxx (1994, H...
│ └ <langchain_community.document_loaders.epub.UnstructuredEPubLoader object at 0x74d4b8b378d0>
└ <function partition_epub at 0x74d4b82322a0>
File "/usr/local/lib/python3.11/site-packages/unstructured/partition/epub.py", line 48, in partition_epub
html_text = convert_file_to_html_text_using_pandoc(
└ <function convert_file_to_html_text_using_pandoc at 0x74d4b82c0ea0>
File "/usr/local/lib/python3.11/site-packages/unstructured/file_utils/file_conversion.py", line 67, in convert_file_to_html_text_using_pandoc
return convert_file_to_text(
└ <function convert_file_to_text at 0x74d4b82c1760>
File "/usr/local/lib/python3.11/site-packages/unstructured/utils.py", line 216, in wrapper
return func(*args, **kwargs)
│ │ └ {'filename': '/app/backend/data/uploads/7cbacd0c-3230-4016-8eff-c851b5103be3_xxx - [xxx 14] - Lords and La...
│ └ ()
└ <function convert_file_to_text at 0x74d4b82c0d60>
File "/usr/local/lib/python3.11/site-packages/unstructured/file_utils/file_conversion.py", line 17, in convert_file_to_text
text = pypandoc.convert_file(filename, target_format, format=source_format)
│ │ │ │ └ 'epub'
│ │ │ └ 'html'
│ │ └ '/app/backend/data/uploads/7cbacd0c-3230-4016-8eff-c851b5103be3_xxx - [xxx 14] - xxx (1994, H...
│ └ <function convert_file at 0x74d4445dee80>
└ <module 'pypandoc' from '/usr/local/lib/python3.11/site-packages/pypandoc/init.py'>
File "/usr/local/lib/python3.11/site-packages/pypandoc/init.py", line 206, in convert_file
return _convert_input(discovered_source_files, format, 'path', to, extra_args=extra_args,
│ │ │ │ └ ()
│ │ │ └ 'html'
│ │ └ 'epub'
│ └ PosixPath('/app/backend/data/uploads/7cbacd0c-3230-4016-8eff-c851b5103be3_xxx - [xxx 14] - xxx...
└ <function _convert_input at 0x74d4445df380>
File "/usr/local/lib/python3.11/site-packages/pypandoc/init.py", line 387, in _convert_input
input_file = sorted(input_file)
└ PosixPath('/app/backend/data/uploads/7cbacd0c-3230-4016-8eff-c851b5103be3_xxx - [xxx 14] - xxx...
TypeError: 'PosixPath' object is not iterable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.11/threading.py", line 1002, in _bootstrap
self._bootstrap_inner()
│ └ <function Thread._bootstrap_inner at 0x74d5559589a0>
└ <WorkerThread(AnyIO worker thread, started 128455081838272)>
File "/usr/local/lib/python3.11/threading.py", line 1045, in _bootstrap_inner
self.run()
│ └ <function WorkerThread.run at 0x74d4b8696d40>
└ <WorkerThread(AnyIO worker thread, started 128455081838272)>
File "/usr/local/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 967, in run
result = context.run(func, *args)
│ │ │ └ ()
│ │ └ functools.partial(<function upload_file at 0x74d509066200>, user=UserModel(id='30d5e137-ad6b-4dbf-9610-6a5a7003e898', name='r...
│ └ <method 'run' of '_contextvars.Context' objects>
└ <_contextvars.Context object at 0x74d4b8c550c0>
File "/app/backend/open_webui/routers/retrieval.py", line 1526, in process_file
raise HTTPException(
└ <class 'fastapi.exceptions.HTTPException'>
fastapi.exceptions.HTTPException: 400: 'PosixPath' object is not iterable
2025-08-14 03:52:21.040 | ERROR | open_webui.routers.files:upload_file:193 - Error processing file: 7cbacd0c-3230-4016-8eff-c851b5103be3
2025-08-14 03:52:21.041 | INFO | uvicorn.protocols.http.httptools_impl:send:476 - 172.16.0.11:61575 - "POST /api/v1/files/ HTTP/1.1" 200
Additional Information
No response
@tjbck commented on GitHub (Aug 17, 2025):
Could you share the file with us?