{"record":{"id":"e6f97e1ed1154540","repo":"PaddlePaddle/PaddleOCR","slug":"no-models-are-available-for-the-language-lang-an","errorCode":null,"errorMessage":"No models are available for the language {lang} and OCR version {ocr_version}.","messagePattern":"No models are available for the language (.+?) and OCR version (.+?)\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"paddleocr/_pipelines/pp_structurev3.py","lineNumber":124,"sourceCode":"            )\n\n        if all(\n            map(\n                lambda p: p is None,\n                (\n                    text_detection_model_name,\n                    text_detection_model_dir,\n                    text_recognition_model_name,\n                    text_recognition_model_dir,\n                ),\n            )\n        ):\n            if lang is not None or ocr_version is not None:\n                det_model_name, rec_model_name = self._get_ocr_model_names(\n                    lang, ocr_version\n                )\n                if det_model_name is None or rec_model_name is None:\n                    raise ValueError(\n                        f\"No models are available for the language {repr(lang)} and OCR version {repr(ocr_version)}.\"\n                    )\n                text_detection_model_name = det_model_name\n                text_recognition_model_name = rec_model_name\n        else:\n            if lang is not None or ocr_version is not None:\n                warnings.warn(\n                    \"`lang` and `ocr_version` will be ignored when model names or model directories are not `None`.\",\n                    stacklevel=2,\n                )\n        params = locals().copy()\n        params[\"text_detection_model_name\"] = text_detection_model_name\n        params[\"text_recognition_model_name\"] = text_recognition_model_name\n        params.pop(\"self\")\n        params.pop(\"kwargs\")\n        self._params = params\n\n        super().__init__(**kwargs)","sourceCodeStart":106,"sourceCodeEnd":142,"githubUrl":"https://github.com/PaddlePaddle/PaddleOCR/blob/2661c7c0ef5c613e8f93c6e93b2e052399f0f854/paddleocr/_pipelines/pp_structurev3.py#L106-L142","documentation":"PPStructureV3 mirrors the OCR pipeline's model-lookup logic: when no explicit det/rec model is configured and lang or ocr_version is set, it calls _get_ocr_model_names(lang, ocr_version); if either model name comes back None it raises ValueError. It means no default model pair exists for that language/version combination in this pipeline's model table.","triggerScenarios":"PPStructureV3(lang='xx', ocr_version='PP-OCRv5') with an unsupported language code; a language that has models in the OCR table but none registered for the structure pipeline's version set (v3–v5); lang given as a full name like 'french'.","commonSituations":"Using full language names instead of codes; migrating a PaddleOCR config (with PP-OCRv6-era langs) into PPStructureV3; requesting a language whose models were added in a newer paddleocr release than the one installed.","solutions":["Use a supported language code (e.g. 'ch', 'en') as listed in the docs for your release.","Pair the language with a version that has models for it (try PP-OCRv4 or PP-OCRv5).","Specify models explicitly via text_detection_model_name and text_recognition_model_name to bypass the lookup."],"exampleFix":"# before\npipe = PPStructureV3(lang='japan', ocr_version='PP-OCRv5')  # ValueError\n# after\npipe = PPStructureV3(lang='japan' if False else 'jap', ocr_version='PP-OCRv4')\n# better: consult the supported lang list and use the exact code, e.g.\npipe = PPStructureV3(lang='jap', ocr_version='PP-OCRv4')","handlingStrategy":"validation","validationCode":"from paddleocr._pipelines.pp_structurev3 import PPStructureV3\n\ndef struct_has_models_for(lang, ocr_version) -> bool:\n    det, rec = PPStructureV3._get_ocr_model_names(lang, ocr_version)\n    return det is not None and rec is not None","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use exact language codes from the docs ('ch', 'en', 'japan')","Check the (lang, ocr_version) pair before construction when supporting many languages","Provide explicit model names as the escape hatch for uncovered languages"],"tags":["pp-structurev3","language","model-lookup","valueerror"],"backgroundTag":null,"analyzedSha":"2661c7c0ef5c613e8f93c6e93b2e052399f0f854","analyzedAt":"2026-08-14T20:17:30.180Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}