From f89dc51661ec36c0b40e88dae85c13ea338700c4 Mon Sep 17 00:00:00 2001 From: Pier-Jean Malandrino Date: Tue, 7 Apr 2026 14:41:20 +0200 Subject: [PATCH] fix: reset _default_converter on init failure (H5) If the lazy-init of the default converter fails (e.g. model download error), the singleton was left as None but subsequent calls would not retry. Now the failed state is cleared so the next request retries. Ref #57 (H5) --- document-parser/infra/local_converter.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/document-parser/infra/local_converter.py b/document-parser/infra/local_converter.py index 8d3eb75..a126e7b 100644 --- a/document-parser/infra/local_converter.py +++ b/document-parser/infra/local_converter.py @@ -118,7 +118,11 @@ def _build_docling_converter(options: ConversionOptions) -> DoclingConverter: def _get_default_converter() -> DoclingConverter: global _default_converter if _default_converter is None: - _default_converter = _build_docling_converter(ConversionOptions()) + try: + _default_converter = _build_docling_converter(ConversionOptions()) + except Exception: + _default_converter = None + raise return _default_converter