PaddlePaddle/PaddleOCR · error · InvalidRequestError
Unsupported document parsing model: {model}
Error message
Unsupported document parsing model: {model} What it means
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.
Source
Thrown at paddleocr/_api_client/_core.py:61
def default_payload(model: Model) -> dict:
if is_ocr_model(model):
return OCROptions().to_payload()
return resolve_document_options(model, None).to_payload()
def resolve_ocr_model(model: Union[Model, str]) -> Model:
resolved = resolve_model(model)
if not is_ocr_model(resolved):
raise InvalidRequestError(f"Unsupported OCR model: {model}")
return resolved
def resolve_document_model(model: Union[Model, str]) -> Model:
resolved = resolve_model(model)
if not is_document_parsing_model(resolved):
raise InvalidRequestError(f"Unsupported document parsing model: {model}")
return resolved
def resolve_model(model: Union[Model, str]) -> Model:
if isinstance(model, Model):
return model
try:
return Model(model)
except ValueError as e:
raise InvalidRequestError(f"Unsupported model: {model}") from e
def resolve_document_options(
model: Model, options: Optional[DocParsingOptions]
) -> DocParsingOptions:
if options is not None:
if model == Model.PP_STRUCTURE_V3 and not isinstance(
options, PPStructureV3OptionsView on GitHub (pinned to 2661c7c0ef)
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.
Example fix
# before job = client.parse_document(file_path="a.pdf", model="PP-OCRv5") # after job = client.parse_document(file_path="a.pdf", model="PP-StructureV3")
Defensive patterns
Strategy: type-guard
Type guard
from paddleocr._api_client.models import is_document_parsing_model, resolve_model
def usable_for_doc_parsing(model) -> bool:
try:
return is_document_parsing_model(resolve_model(model))
except Exception:
return False Prevention
- Validate the configured document-parsing model at app startup.
- Pass Model enum members instead of free-form strings.
When it happens
Trigger: Calling a document-parsing method with an OCR-only model (or any non document-parsing Model), e.g. model='PP-OCRv5'.
Common situations: Switching an existing OCR pipeline to document parsing without changing the configured model, or assuming all Model values work with every endpoint.
Related errors
- Unsupported OCR model: {model}
- Unsupported model: {model}
- PP-StructureV3 requires PPStructureV3Options.
- PaddleOCR-VL models require PaddleOCRVLOptions.
- Job model is not an OCR model: {job.model}.
AI-assisted analysis of PaddlePaddle/PaddleOCR@2661c7c0ef (2026-08-14).
Data as JSON: /api/errors/b95ffee773fa25ed.
Report an issue: GitHub.