Skip to content

Crash in document-decoder #949

Closed

Description

@cybermaggedon

2.4.29. Suddenly started appearing on a standard test doc?

2026-05-26 11:23:58,061 - document-decoder - ERROR - Message processing exception: module 'matplotlib.ft2font' has no attribute '__path__'
Traceback (most recent call last):
  File "/usr/local/lib/python3.13/site-packages/trustgraph/base/consumer.py", line 239, in handle_one_from_queue
    await self.handler(msg, self, self.flow)
  File "/usr/local/lib/python3.13/site-packages/trustgraph/decoding/universal/processor.py", line 421, in on_message
    elements = self.extract_elements(blob, mime_type)
  File "/usr/local/lib/python3.13/site-packages/trustgraph/decoding/universal/processor.py", line 200, in extract_elements
    elements = partition(**kwargs)
  File "/usr/local/lib/python3.13/site-packages/unstructured/partition/auto.py", line 215, in partition
    partition_pdf = partitioner_loader.get(file_type)
  File "/usr/local/lib/python3.13/site-packages/unstructured/partition/auto.py", line 371, in get
    self._partitioners[file_type] = self._load_partitioner(file_type)
                                    ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/unstructured/partition/auto.py", line 389, in _load_partitioner
    partitioner_module = importlib.import_module(file_type.partitioner_module_qname)
  File "/usr/lib64/python3.13/importlib/__init__.py", line 88, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1395, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 1023, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/usr/local/lib/python3.13/site-packages/unstructured/partition/pdf.py", line 55, in <module>
    from unstructured.partition.pdf_image.pdfminer_processing import (
    ...<4 lines>...
    )
  File "/usr/local/lib/python3.13/site-packages/unstructured/partition/pdf_image/pdfminer_processing.py", line 17, in <module>
    from unstructured.partition.pdf_image.pdf_image_utils import remove_control_characters
  File "/usr/local/lib/python3.13/site-packages/unstructured/partition/pdf_image/pdf_image_utils.py", line 17, in <module>
    from unstructured_inference.inference.layout import convert_pdf_to_image as render_pdf_to_image
  File "/usr/local/lib/python3.13/site-packages/unstructured_inference/inference/layout.py", line 23, in <module>
    from unstructured_inference.visualize import draw_bbox
  File "/usr/local/lib/python3.13/site-packages/unstructured_inference/visualize.py", line 7, in <module>
    import matplotlib.pyplot as plt
  File "/usr/local/lib64/python3.13/site-packages/matplotlib/pyplot.py", line 57, in <module>
    import matplotlib.image
  File "/usr/local/lib64/python3.13/site-packages/matplotlib/image.py", line 25, in <module>
    from matplotlib.backend_bases import FigureCanvasBase
  File "/usr/local/lib64/python3.13/site-packages/matplotlib/backend_bases.py", line 49, in <module>
    from matplotlib import (
        _api, backend_tools as tools, cbook, colors, _docstring, text,
        _tight_bbox, transforms, widgets, is_interactive, rcParams)
  File "/usr/local/lib64/python3.13/site-packages/matplotlib/text.py", line 18, in <module>
    from .textpath import TextPath, TextToPath  # noqa # Logically located here
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib64/python3.13/site-packages/matplotlib/textpath.py", line 7, in <module>
    from matplotlib import _text_helpers, dviread
  File "/usr/local/lib64/python3.13/site-packages/matplotlib/_text_helpers.py", line 10, in <module>
    from .ft2font import FT2Font, Kerning, LoadFlags
RuntimeError: module 'matplotlib.ft2font' has no attribute '__path__'

Activity

  1. cybermaggedon commented on May 26, 2026

    @cybermaggedon
    ContributorAuthor

    Turns out the cause was an HTML doc fed in as a PDF doc. The test data doc was removed and so URL just returns an HTML error page

  2. cybermaggedon commented on May 26, 2026

    @cybermaggedon
    ContributorAuthor

    Maybe the real problem is that some validation should have taken place.

  3. jmolz commented on Jun 7, 2026

    @jmolz
    Contributor

    Opened PR #977 to handle this: #977

    The patch validates decoded PDF bytes before invoking the PDF loader, so HTML error pages or other non-PDF content are ignored without emitting page documents. Added unit coverage for librarian-backed content that is labeled as a PDF but contains HTML.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions