From e17db990af7fd1cd16faa6158aaeed703475f97e Mon Sep 17 00:00:00 2001 From: Classic298 <27028174+Classic298@users.noreply.github.com> Date: Mon, 27 Jul 2026 08:01:04 +0200 Subject: [PATCH] fix: parse .msg uploads via unstructured instead of extract_msg (#26704) The .msg branch routed to langchain's OutlookMessageLoader, which requires the extract_msg package. extract_msg pins beautifulsoup4<4.14, but we pin unstructured==0.22.31 (needs beautifulsoup4>=4.14.3) and beautifulsoup4==4.14.3, so extract_msg can never be installed alongside the current dependency set. As a result the .msg path could not function on any supported install: uploads failed at runtime with an ImportError, and adding the missing package broke the build with an unsatisfiable resolver error. Switch to UnstructuredEmailLoader, which parses .msg through unstructured's partition_msg (backed by python-oxmsg). Both are already shipped, so .msg uploads work with no new dependency and no version conflict. Attachment partitioning is disabled to preserve the previous body-only extraction behaviour. Fixes #26690 --- backend/open_webui/retrieval/loaders/main.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/backend/open_webui/retrieval/loaders/main.py b/backend/open_webui/retrieval/loaders/main.py index 3c8b1f11b2..8aecf2e992 100644 --- a/backend/open_webui/retrieval/loaders/main.py +++ b/backend/open_webui/retrieval/loaders/main.py @@ -11,7 +11,6 @@ from langchain_community.document_loaders import ( BSHTMLLoader, CSVLoader, Docx2txtLoader, - OutlookMessageLoader, PyPDFLoader, TextLoader, YoutubeLoader, @@ -677,7 +676,18 @@ class Loader: ) loader = PptxLoader(file_path) elif file_ext == 'msg': - loader = OutlookMessageLoader(file_path) + try: + from langchain_community.document_loaders import ( + UnstructuredEmailLoader, + ) + + # unstructured parses .msg via python-oxmsg; avoids extract_msg's beautifulsoup4<4.14 conflict + loader = UnstructuredEmailLoader(file_path, process_attachments=False) + except ImportError: + raise ValueError( + "Processing .msg files requires the 'unstructured' package. " + 'Install it with: pip install unstructured' + ) elif file_ext == 'odt': try: from langchain_community.document_loaders import UnstructuredODTLoader