docling-project / docling-project/docling

RuntimeError: [json.exception.type_error.302] type must be number, but is object

Open
#1,157 1 comment 0 reactions 1 assignee Claimed by @PeterStaar-IBM View on GitHub
bug pdf parsing triage/close-stale
Dominant language
Python
Stars
66.4k
Forks
4.8k
Avg merge
2d 21h
Merged PRs (30d)
84

Description

### Bug
The error happens very rarely, with certain pdf files. Here is an example of such a file - [Marseille.pdf](https://github.com/user-attachments/files/19228200/Marseille.pdf). And actually I have already encountered a similar problem, but in pypdf, and it was solved, so I leave a [link to this issue](https://github.com/py-pdf/pypdf/issues/3153). [Resolved here](https://github.com/py-pdf/pypdf/pull/3158). It would be ideal if you could also ignore such errors, thanks in advance.

### Logs:
```bash
Traceback (most recent call last):

File "...\venv\Lib\site-packages\docling\pipeline\base_pipeline.py", line 163, in _build_document
for p in pipeline_pages: # Must exhaust!

File "...\venv\Lib\site-packages\docling\pipeline\base_pipeline.py", line 127, in _apply_on_pages
yield from page_batch

File "...\venv\Lib\site-packages\docling\models\page_assemble_model.py", line 68, in __call__
for page in page_batch:

File "...\venv\Lib\site-packages\docling\models\table_structure_model.py", line 178, in __call__
for page in page_batch:

File "...\venv\Lib\site-packages\docling\models\layout_model.py", line 146, in __call__
for page in page_batch:

File "...\venv\Lib\site-packages\docling\models\easyocr_model.py", line 127, in __call__
for page in page_batch:

File "...\venv\Lib\site-packages\docling\models\page_preprocessing_model.py", line 25, in __call__
for page in page_batch:

File "...\venv\Lib\site-packages\docling\pipeline\standard_pdf_pipeline.py", line 229, in initialize_page
page._backend = conv_res.input._backend.load_page(page.page_no) # type: ignore
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "...\venv\Lib\site-packages\docling\backend\docling_parse_v2_backend.py", line 246, in load_page
return DoclingParseV2PageBackend(
^^^^^^^^^^^^^^^^^^^^^^^^^^

File "...\venv\Lib\site-packages\docling\backend\docling_parse_v2_backend.py", line 28, in __init__
parsed_page = parser.parse_pdf_from_key_on_page(document_hash, page_no)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

RuntimeError: [json.exception.type_error.302] type must be number, but is object
```

### Steps to reproduce
Try to call the convert method on the attached file

### Docling version
v2.26.0

### Python version
3.11

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.