You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Convert PDF file error [RuntimeError: Invalid code point] #1111
located in docling>backend>docling_parse_v2_backend.py.
Error Message
python3.12/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: Invalid code point
We have the exact same issue with this one page file pranger-3.pdf, in case you need another file for easier debuggig.
UPDATE: We noticed this error behavior for several other PDF-pages printed from the german Wikipedia. What they all had in common were at least one Korean character. If we had to guess from our current knowledge it seems that some PDF Writer encode these characters in a specific way incomaptible with doclings architecture.
do_ocr only does ocr if there is no layer at all.
In our workflow we're checking the pdf for a layer and whether it's useful. If not, we set the force_full_page_ocr to true. (this creates a new pipeline, which takes one or two seconds)
Still no solution for "RuntimeError: Invalid code point" ? I get it on several of my pdfs, for no apparent reason.
There's not even any image in the source PDF (it's just digital text).
I'm still getting this issue on some documents. Only workaround I found is to find the exact page where it happens, convert to image and use the ocr on that page.
Me too, I also experienced the same issue. Got the same error without useful hints. Let me drop my error log just for someone who's interested:
2025-10-28 15:22:14,841 - INFO - detected formats: [<InputFormat.PDF: 'pdf'>]
2025-10-28 15:22:14,863 - INFO - Going to convert document batch...
2025-10-28 15:22:14,864 - INFO - Initializing pipeline for StandardPdfPipeline with options hash 0736d5c3d20fb1ebbc3435380ccdf6fa
2025-10-28 15:22:14,866 - INFO - Loading plugin 'docling_defaults'
2025-10-28 15:22:14,867 - INFO - Registered picture descriptions: ['vlm', 'api']
2025-10-28 15:22:14,871 - INFO - Loading plugin 'docling_defaults'
2025-10-28 15:22:14,873 - INFO - Registered ocr engines: ['auto', 'easyocr', 'ocrmac', 'rapidocr', 'tesserocr', 'tesseract']
/home/grlee/ghrepo/pdfscribe2d/.venv/lib/python3.11/site-packages/docling/models/easyocr_model.py:68: UserWarning: Deprecated field. Better to set the `accelerator_options.device` in `pipeline_options`. When `use_gpu and accelerator_options.device == AcceleratorDevice.CUDA` the GPU is used to run EasyOCR. Otherwise, EasyOCR runs in CPU.
warnings.warn(
2025-10-28 15:22:16,923 - INFO - Accelerator device: 'cuda:0'
2025-10-28 15:22:17,956 - INFO - Accelerator device: 'cuda:0'
2025-10-28 15:22:18,323 - INFO - Processing document example_report_2.pdf
2025-10-28 15:22:18,463 - WARNING - Encountered an error during conversion of document f917ab50ae5c1e6e0b4b683fe2a2d51ff2e39dbdc2a491f4e5321f2c3c8278ab:
Traceback (most recent call last):
File "/home/grlee/ghrepo/pdfscribe2d/.venv/lib/python3.11/site-packages/docling/pipeline/base_pipeline.py", line 230, in _build_document
for p in pipeline_pages: # Must exhaust!
File "/home/grlee/ghrepo/pdfscribe2d/.venv/lib/python3.11/site-packages/docling/pipeline/base_pipeline.py", line 195, in _apply_on_pages
yield from page_batch
File "/home/grlee/ghrepo/pdfscribe2d/.venv/lib/python3.11/site-packages/docling/models/page_assemble_model.py", line 70, in __call__
for page in page_batch:
File "/home/grlee/ghrepo/pdfscribe2d/.venv/lib/python3.11/site-packages/docling/models/table_structure_model.py", line 177, in __call__
for page in page_batch:
File "/home/grlee/ghrepo/pdfscribe2d/.venv/lib/python3.11/site-packages/docling/models/layout_model.py", line 152, in __call__
pages = list(page_batch)
^^^^^^^^^^^^^^^^
File "/home/grlee/ghrepo/pdfscribe2d/.venv/lib/python3.11/site-packages/docling/models/easyocr_model.py", line 136, in __call__
for page in page_batch:
File "/home/grlee/ghrepo/pdfscribe2d/.venv/lib/python3.11/site-packages/docling/models/page_preprocessing_model.py", line 48, in __call__
page = self._parse_page_cells(conv_res, page)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/grlee/ghrepo/pdfscribe2d/.venv/lib/python3.11/site-packages/docling/models/page_preprocessing_model.py", line 72, in _parse_page_cells
page.parsed_page = page._backend.get_segmented_page()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/grlee/ghrepo/pdfscribe2d/.venv/lib/python3.11/site-packages/docling/backend/docling_parse_v4_backend.py", line 109, in get_segmented_page
self._ensure_parsed()
File "/home/grlee/ghrepo/pdfscribe2d/.venv/lib/python3.11/site-packages/docling/backend/docling_parse_v4_backend.py", line 57, in _ensure_parsed
seg_page = self._dp_doc.get_page(
^^^^^^^^^^^^^^^^^^^^^^
File "/home/grlee/ghrepo/pdfscribe2d/.venv/lib/python3.11/site-packages/docling_parse/pdf_parser.py", line 162, in get_page
doc_dict = self._parser.parse_pdf_from_key_on_page(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: Invalid code point
/home/grlee/ghrepo/pdfscribe2d/.venv/lib/python3.11/site-packages/docling/datamodel/base_models.py:456: RuntimeWarning: Mean of empty slice
np.nanmean(
/home/grlee/ghrepo/pdfscribe2d/.venv/lib/python3.11/site-packages/docling/datamodel/base_models.py:465: RuntimeWarning: Mean of empty slice
np.nanmean(
...
RuntimeError: Invalid code point
One noteable error message was Mean of empty slice. Maybe some mistakes or incomplete exception handling within the program logic?
@KnightChaser there have been quite some fixes in the parser. Can you please provide the output of docling --version? you should look in particular for the version of the docling-parse package.
My current Docling version is 2.58.0(Docling Parse version is 4.7.0) according to the result of the command docling --version. Since the latest release of Docling Parse version is 4.7.0 as well, I think I'm using the latest available version?
The file provided in the first comment of this issue seems to be resolved. @KnightChaser If you still get it with the latest version, can you please share a file to reproduce it?
I also tried to parse other random PDF documents and they all worked well with Docling smoothly. I think my first PDF document, the uploaded one, was structurally malformed, even though the visual appearance looks sane enough.
I tested the four files in this thread that I could download (default.pdf from the first post, pranger-3.pdf, 2025_08_report_published_kr.pdf and NASA_23_p1.pdf) on several docling-parse releases. The PMC link in this thread returns a bot-check page, so I could not test that one.
The crash is fixed in docling-parse 7.16.0 and later.
docling-parse
result
4.7.3, 5.3.2, 5.3.3
RuntimeError: Invalid code point on all four files
5.4.0 – 7.15.0
some pages fail with UnicodeDecodeError instead
7.16.0 – 7.22.x
all pages parse
If you still see this error, check docling --version and upgrade docling-parse to 7.16.0 or later.
Some text was still wrong after 7.16.0. Large Korean and CJK fonts use character codes between 0xD800 and 0xDFFF. The parser read those /ToUnicode codes as UTF-16 text, so it lost their mappings, and it could also overwrite the mapping of another code. On NASA_23_p1.pdf, the curly quotes came out as U+FFFD and every space in the Korean font came out as ”. The root cause is docling-project/docling-parse#145, and the fix is in docling-project/docling-parse#419.
2025_08_report_published_kr.pdf pages 1–2 are a different case. The title fonts have no /ToUnicode entry for most of the codes they use, and pdftotext also gets no text from them. For those pages, OCR (force_full_page_ocr=True) is the only way to get the text.
Activity
LuRe97 commentedon Mar 19, 2025
We have the exact same issue with this one page file pranger-3.pdf, in case you need another file for easier debuggig.
UPDATE: We noticed this error behavior for several other PDF-pages printed from the german Wikipedia. What they all had in common were at least one Korean character. If we had to guess from our current knowledge it seems that some PDF Writer encode these characters in a specific way incomaptible with doclings architecture.
geonhak904 commentedon Mar 26, 2025
same issue in here.
widium commentedon Apr 7, 2025
same issue in here.
developers-dev commentedon Apr 21, 2025
same issue...
syats commentedon Apr 22, 2025
Same issue with PDF: https://pmc.ncbi.nlm.nih.gov/articles/PMC8637917/pdf/jdapm-21-507.pdf
luke-z commentedon Jul 28, 2025
I tried forcing ocr with do_ocr = True, this also causes the invalid code point error.
Converting the pdf to an image beforehand seems to make it work. So it must be a PDF pipeline problem
geekypilot commentedon Aug 23, 2025
I'm seeing the same issue on several PDFs. It occurs both with do_ocr = True and do_ocr = False.
mayurtikundi12 commentedon Sep 21, 2025
did anyone find any solution?
luke-z commentedon Sep 21, 2025
You could try this:
https://docling-project.github.io/docling/reference/pipeline_options/#docling.datamodel.pipeline_options.EasyOcrOptions.force_full_page_ocr
do_ocr only does ocr if there is no layer at all.
In our workflow we're checking the pdf for a layer and whether it's useful. If not, we set the force_full_page_ocr to true. (this creates a new pipeline, which takes one or two seconds)
dorianmeric commentedon Oct 13, 2025
Still no solution for "RuntimeError: Invalid code point" ? I get it on several of my pdfs, for no apparent reason.
There's not even any image in the source PDF (it's just digital text).
This person seems to have at least found a potential cause: docling-project/docling-parse#145 (comment)
danielelongo14 commentedon Oct 21, 2025
I'm still getting this issue on some documents. Only workaround I found is to find the exact page where it happens, convert to image and use the ocr on that page.
KnightChaser commentedon Oct 28, 2025
Me too, I also experienced the same issue. Got the same error without useful hints. Let me drop my error log just for someone who's interested:
One noteable error message was
Mean of empty slice. Maybe some mistakes or incomplete exception handling within the program logic?dolfim-ibm commentedon Oct 28, 2025
@KnightChaser there have been quite some fixes in the parser. Can you please provide the output of
docling --version? you should look in particular for the version of the docling-parse package.KnightChaser commentedon Oct 28, 2025
@dolfim-ibm
My current Docling version is
2.58.0(Docling Parse version is4.7.0) according to the result of the commanddocling --version. Since the latest release of Docling Parse version is4.7.0as well, I think I'm using the latest available version?dolfim-ibm commentedon Oct 28, 2025
The file provided in the first comment of this issue seems to be resolved. @KnightChaser If you still get it with the latest version, can you please share a file to reproduce it?
KnightChaser commentedon Oct 28, 2025
@dolfim-ibm
Here, I attached the problematic document.
2025_08_report_published_kr.pdf
I also tried to parse other random PDF documents and they all worked well with Docling smoothly. I think my first PDF document, the uploaded one, was structurally malformed, even though the visual appearance looks sane enough.
kylee0643 commentedon Feb 10, 2026
I have same issue with this pdf.
Docling version: 2.72.0
Docling Core version: 2.64.0
Docling IBM Models version: 3.11.0
Docling Parse version: 4.7.3
Python: cpython-314 (3.14.3)
Platform: Windows-11-10.0.26200-SP0
NASA_23_p1.pdf
wittjeff commentedon Oct 20, 2026
I tested the four files in this thread that I could download (
default.pdffrom the first post,pranger-3.pdf,2025_08_report_published_kr.pdfandNASA_23_p1.pdf) on several docling-parse releases. The PMC link in this thread returns a bot-check page, so I could not test that one.The crash is fixed in docling-parse 7.16.0 and later.
RuntimeError: Invalid code pointon all four filesUnicodeDecodeErrorinsteadIf you still see this error, check
docling --versionand upgradedocling-parseto 7.16.0 or later.Some text was still wrong after 7.16.0. Large Korean and CJK fonts use character codes between
0xD800and0xDFFF. The parser read those/ToUnicodecodes as UTF-16 text, so it lost their mappings, and it could also overwrite the mapping of another code. OnNASA_23_p1.pdf, the curly quotes came out as U+FFFD and every space in the Korean font came out as”. The root cause is docling-project/docling-parse#145, and the fix is in docling-project/docling-parse#419.2025_08_report_published_kr.pdfpages 1–2 are a different case. The title fonts have no/ToUnicodeentry for most of the codes they use, andpdftotextalso gets no text from them. For those pages, OCR (force_full_page_ocr=True) is the only way to get the text.