{"record":{"id":"955b2f958e4b9475","repo":"docling-project/docling","slug":"unknown-rapidocr-backend-backend-r-in-value-r","errorCode":null,"errorMessage":"Unknown RapidOCR backend {backend!r} in {value!r}. Supported: {list(_RAPIDOCR_BACKENDS)}.","messagePattern":"Unknown RapidOCR backend (.+?) in (.+?)\\. Supported: (.+?)\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"docling/models/stages/ocr/rapid_ocr_model.py","lineNumber":112,"sourceCode":"\n    # PP-OCR backbone that the (backend, language) pair resolves to.\n    ppocr_version: \"OCRVersion | None\" = None\n\n\ndef _parse_rapidocr_model_spec(value: str) -> _RapidOcrModelSpec:\n    \"\"\"Parse a `<backend>:<lang>` prefetch spec into its requested form.\n\n    The pair is routed through _resolve_rapidocr so the prefetcher can never accept a\n    combination the runtime would reject, but only the user's own values are kept.\n    \"\"\"\n    backend, separator, lang = value.partition(\":\")\n    if not separator or not backend or not lang or \":\" in lang:\n        raise ValueError(\n            f\"Invalid RapidOCR model spec {value!r}. \"\n            \"Expected '<backend>:<lang>', e.g. 'onnxruntime:th'.\"\n        )\n    if backend not in _RAPIDOCR_BACKENDS:\n        raise ValueError(\n            f\"Unknown RapidOCR backend {backend!r} in {value!r}. \"\n            f\"Supported: {list(_RAPIDOCR_BACKENDS)}.\"\n        )\n    try:\n        _resolve_rapidocr(lang, backend)\n    except ValueError as err:\n        raise ValueError(f\"Invalid RapidOCR model spec {value!r}: {err}\") from err\n    return _RapidOcrModelSpec(backend=backend, user_lang=lang)\n\n\ndef _backend_to_engine_type(backend: str) -> \"EngineType\":\n    \"\"\"Map a docling backend name onto the rapidocr EngineType it stands for.\"\"\"\n    from rapidocr.utils.typings import EngineType\n\n    engine_types = {\n        \"onnxruntime\": EngineType.ONNXRUNTIME,\n        \"openvino\": EngineType.OPENVINO,\n        \"paddle\": EngineType.PADDLE,","sourceCodeStart":94,"sourceCodeEnd":130,"githubUrl":"https://github.com/docling-project/docling/blob/61d76f1ff3f8428065465889f7b4577da7df704c/docling/models/stages/ocr/rapid_ocr_model.py#L94-L130","documentation":"After the '<backend>:<lang>' shape check, the parser verifies the backend part against _RAPIDOCR_BACKENDS (onnxruntime, openvino, paddle, torch — the inference engines rapidocr supports). An unknown backend name raises ValueError listing the supported set, so the failure happens at configuration time rather than deep inside rapidocr.","triggerScenarios":"Passing a spec like 'onnx:th', 'cuda:en', or 'paddlelite:ch' — any backend string not in _RAPIDOCR_BACKENDS — to the RapidOCR model prefetch configuration.","commonSituations":"Using rapidocr's own backend names or GPU labels from other tools; older docling versions with a smaller backend set; guessing engine names instead of checking the supported list.","solutions":["Use only backends from the supported list printed in the error, e.g. 'onnxruntime:th'.","Install the engine you want (e.g. onnxruntime or openvino) and keep the spec string aligned with that engine's name.","Upgrade docling if you expected a newly added backend (like torch) that your version does not know."],"exampleFix":"# before\nspec = \"onnx:th\"  # backend not in _RAPIDOCR_BACKENDS -> ValueError\n\n# after\nspec = \"onnxruntime:th\"","handlingStrategy":"validation","validationCode":"RAPIDOCR_BACKENDS = {\"onnxruntime\", \"openvino\", \"paddle\", \"torch\"}\n\ndef valid_backend(spec: str) -> bool:\n    return spec.partition(\":\")[0] in RAPIDOCR_BACKENDS","typeGuard":"def is_known_rapidocr_backend(backend: str) -> bool:\n    return backend in {\"onnxruntime\", \"openvino\", \"paddle\", \"torch\"}","tryCatchPattern":null,"preventionTips":["Copy backend names from the error message's supported list, never from memory or other tools.","Pin the docling version whose backend list you coded against; re-check on upgrades.","Use config enums/literals for backend names to make typos impossible."],"tags":["rapidocr","ocr","backend","validation"],"backgroundTag":null,"analyzedSha":"61d76f1ff3f8428065465889f7b4577da7df704c","analyzedAt":"2026-08-14T23:53:18.727Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}