{"record":{"id":"b95ffee773fa25ed","repo":"PaddlePaddle/PaddleOCR","slug":"unsupported-document-parsing-model-model","errorCode":null,"errorMessage":"Unsupported document parsing model: {model}","messagePattern":"Unsupported document parsing model: (.+?)","errorType":"validation","errorClass":"InvalidRequestError","httpStatus":null,"severity":"error","filePath":"paddleocr/_api_client/_core.py","lineNumber":61,"sourceCode":"\n\ndef default_payload(model: Model) -> dict:\n    if is_ocr_model(model):\n        return OCROptions().to_payload()\n    return resolve_document_options(model, None).to_payload()\n\n\ndef resolve_ocr_model(model: Union[Model, str]) -> Model:\n    resolved = resolve_model(model)\n    if not is_ocr_model(resolved):\n        raise InvalidRequestError(f\"Unsupported OCR model: {model}\")\n    return resolved\n\n\ndef resolve_document_model(model: Union[Model, str]) -> Model:\n    resolved = resolve_model(model)\n    if not is_document_parsing_model(resolved):\n        raise InvalidRequestError(f\"Unsupported document parsing model: {model}\")\n    return resolved\n\n\ndef resolve_model(model: Union[Model, str]) -> Model:\n    if isinstance(model, Model):\n        return model\n    try:\n        return Model(model)\n    except ValueError as e:\n        raise InvalidRequestError(f\"Unsupported model: {model}\") from e\n\n\ndef resolve_document_options(\n    model: Model, options: Optional[DocParsingOptions]\n) -> DocParsingOptions:\n    if options is not None:\n        if model == Model.PP_STRUCTURE_V3 and not isinstance(\n            options, PPStructureV3Options","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/PaddlePaddle/PaddleOCR/blob/2661c7c0ef5c613e8f93c6e93b2e052399f0f854/paddleocr/_api_client/_core.py#L43-L79","documentation":"Raised as InvalidRequestError by resolve_document_model() when the resolved model is not a document-parsing model. It mirrors resolve_ocr_model: the value may be a valid Model, but it does not belong to the document-parsing set, so the document-parsing API refuses it client-side.","triggerScenarios":"Calling a document-parsing method with an OCR-only model (or any non document-parsing Model), e.g. model='PP-OCRv5'.","commonSituations":"Switching an existing OCR pipeline to document parsing without changing the configured model, or assuming all Model values work with every endpoint.","solutions":["Use a document-parsing model such as PP-StructureV3 or a PaddleOCR-VL model for document-parsing calls.","Verify the model against the document-parsing set in the Model enum.","Keep separate config keys for OCR vs document-parsing model names."],"exampleFix":"# before\njob = client.parse_document(file_path=\"a.pdf\", model=\"PP-OCRv5\")\n\n# after\njob = client.parse_document(file_path=\"a.pdf\", model=\"PP-StructureV3\")","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"from paddleocr._api_client.models import is_document_parsing_model, resolve_model\n\ndef usable_for_doc_parsing(model) -> bool:\n    try:\n        return is_document_parsing_model(resolve_model(model))\n    except Exception:\n        return False","tryCatchPattern":null,"preventionTips":["Validate the configured document-parsing model at app startup.","Pass Model enum members instead of free-form strings."],"tags":["validation","model","client-side"],"backgroundTag":null,"analyzedSha":"2661c7c0ef5c613e8f93c6e93b2e052399f0f854","analyzedAt":"2026-08-14T20:17:30.180Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}