{"record":{"id":"d666f8b635c62a4b","repo":"PaddlePaddle/PaddleOCR","slug":"unsupported-model-model","errorCode":null,"errorMessage":"Unsupported model: {model}","messagePattern":"Unsupported model: (.+?)","errorType":"validation","errorClass":"InvalidRequestError","httpStatus":null,"severity":"error","filePath":"paddleocr/_api_client/_core.py","lineNumber":71,"sourceCode":"    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\n        ):\n            raise InvalidRequestError(\"PP-StructureV3 requires PPStructureV3Options.\")\n        if is_vl_model(model) and not isinstance(options, PaddleOCRVLOptions):\n            raise InvalidRequestError(\"PaddleOCR-VL models require PaddleOCRVLOptions.\")\n        return options\n    if model == Model.PP_STRUCTURE_V3:\n        return PPStructureV3Options()\n    return PaddleOCRVLOptions()\n\n","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/PaddlePaddle/PaddleOCR/blob/2661c7c0ef5c613e8f93c6e93b2e052399f0f854/paddleocr/_api_client/_core.py#L53-L89","documentation":"Raised as InvalidRequestError by resolve_model() when the argument is a string that does not match any Model enum value (Model(model) raises ValueError, chained here), or when it is neither a Model instance nor a coercible string. It is the generic model-resolution failure behind the OCR/document-specific variants.","triggerScenarios":"Passing model=\"my-model\", a typo like \"pp-ocrv4 \" (case/whitespace), a deprecated model name removed in this version, or a non-string non-Model object.","commonSituations":"Version upgrades that rename or remove Model members, config files carrying stale names, or dynamically built strings with wrong casing.","solutions":["Check the Model enum in this package version for the exact accepted names.","Fix casing/whitespace in the configured model string.","If the name was removed in an upgrade, migrate to the current equivalent model.","Prefer passing the Model enum member instead of a raw string."],"exampleFix":"# before\nresult = client.ocr(file_path=\"a.png\", model=\"ppocrv5\")\n\n# after\nfrom paddleocr._api_client.models import Model\nresult = client.ocr(file_path=\"a.png\", model=Model.PP_OCRv5)","handlingStrategy":"validation","validationCode":"from paddleocr._api_client.models import Model\n\ndef valid_model(name: str) -> bool:\n    try:\n        Model(name)\n        return True\n    except ValueError:\n        return False\n\nassert valid_model(configured_model), f\"unknown model {configured_model!r}\"","typeGuard":"from paddleocr._api_client.models import Model\n\ndef is_known_model(value) -> bool:\n    if isinstance(value, Model):\n        return True\n    try:\n        Model(value)\n        return True\n    except ValueError:\n        return False","tryCatchPattern":null,"preventionTips":["Load model names from config and validate them against Model at boot.","After upgrading the package, diff the Model enum for removed names."],"tags":["validation","model","enum","client-side"],"backgroundTag":null,"analyzedSha":"2661c7c0ef5c613e8f93c6e93b2e052399f0f854","analyzedAt":"2026-08-14T20:17:30.180Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}