langflow icon indicating copy to clipboard operation
langflow copied to clipboard

UTF 8

Open VGLOQO opened this issue 1 year ago • 4 comments

How to solve UTF 8 issue while processing few pdfs for Rag.. any solution ?

VGLOQO avatar Nov 02 '25 15:11 VGLOQO

Could you share more information about your UTF-8 issue, along with details on what tools you used to process it?

AntonioABLima avatar Nov 03 '25 23:11 AntonioABLima

when I upload PDF below error I can see in --opik

exception_type: RuntimeError message: called add_log but no component context found traceback: | Traceback (most recent call last): File "/app/.venv/lib/python3.12/site-packages/langflow/base/data/utils.py", line 144, in parse_text_file_to_data text = read_text_file(file_path) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/.venv/lib/python3.12/site-packages/langflow/base/data/utils.py", line 120, in read_text_file return file_path_.read_text(encoding=encoding) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/pathlib.py", line 1028, in read_text return f.read() ^^^^^^^^ File "", line 322, in decode UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe2 in position 10: invalid continuation byte

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "", line 609, in process_file_standard File "/app/.venv/lib/python3.12/site-packages/langflow/base/data/utils.py", line 163, in parse_text_file_to_data raise ValueError(msg) from e ValueError: Error loading file /app/data/.cache/langflow/21468e03-890a-4f62-903d-fd94fb652ec6/UVM Signum Blockchain Fund VCC Report for 1Q2025_174843.PDF: 'utf-8' codec can't decode byte 0xe2 in position 10: invalid continuation byte

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/app/.venv/lib/python3.12/site-packages/langflow/custom/custom_component/component.py", line 1064, in build_results return await self._build_with_tracing() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/.venv/lib/python3.12/site-packages/langflow/custom/custom_component/component.py", line 1046, in _build_with_tracing results, artifacts = await self._build_results() ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/.venv/lib/python3.12/site-packages/langflow/custom/custom_component/component.py", line 1091, in _build_results result = await self._get_output_result(output) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/.venv/lib/python3.12/site-packages/langflow/custom/custom_component/component.py", line 1166, in _get_output_result result = await method() if inspect.iscoroutinefunction(method) else await asyncio.to_thread(method) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/threads.py", line 25, in to_thread return await loop.run_in_executor(None, func_call) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/.venv/lib/python3.12/site-packages/langflow/base/data/base_file.py", line 382, in load_files data_list = self.load_files_core() ^^^^^^^^^^^^^^^^^^^^^^ File "/app/.venv/lib/python3.12/site-packages/langflow/base/data/base_file.py", line 239, in load_files_core data_list = self.load_files_base() ^^^^^^^^^^^^^^^^^^^^^^ File "/app/.venv/lib/python3.12/site-packages/langflow/base/data/base_file.py", line 216, in load_files_base processed_files = self.process_files(final_files) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "", line 649, in process_files File "/app/.venv/lib/python3.12/site-packages/langflow/base/data/utils.py", line 198, in parallel_load_data return list(loaded_files) ^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/concurrent/futures/_base.py", line 619, in result_iterator yield _result_or_cancel(fs.pop()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/concurrent/futures/_base.py", line 317, in _result_or_cancel return fut.result(timeout) ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/concurrent/futures/_base.py", line 449, in result return self.__get_result() ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result raise self._exception File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/.venv/lib/python3.12/site-packages/langflow/base/data/utils.py", line 194, in lambda file_path: load_function(file_path, silent_errors=silent_errors), ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "", line 616, in process_file_standard File "/app/.venv/lib/python3.12/site-packages/langflow/custom/custom_component/component.py", line 1453, in log self._tracing_service.add_log(trace_name=self.trace_name, log=log) File "/app/.venv/lib/python3.12/site-packages/langflow/services/tracing/service.py", line 415, in add_log raise RuntimeError(msg) RuntimeError: called add_log but no component context found

VGLOQO avatar Nov 05 '25 00:11 VGLOQO

Image

VGLOQO avatar Nov 05 '25 00:11 VGLOQO

Hi @VGLOQO

I tried to reproduce your bug in the latest version, but it doesn't work. Could you please check if it occurs in the last langflow version?

andifilhohub avatar Jan 07 '26 17:01 andifilhohub