PaddlePaddle/PaddleOCR · error · InvalidRequestError
Job model is not a document parsing model: {job.model}.
Error message
Job model is not a document parsing model: {job.model}. What it means
Raised as InvalidRequestError by job_id_for_task() when task == 'document_parsing' but the Job's model fails is_document_parsing_model(). It prevents calling a document-parsing endpoint with a job created for a different model family.
Source
Thrown at paddleocr/_api_client/_core.py:100
if is_vl_model(model) and not isinstance(options, PaddleOCRVLOptions):
raise InvalidRequestError("PaddleOCR-VL models require PaddleOCRVLOptions.")
return options
if model == Model.PP_STRUCTURE_V3:
return PPStructureV3Options()
return PaddleOCRVLOptions()
def job_id_for_task(job: Union[Job, str], task: str) -> str:
if isinstance(job, str):
return job
if job.task != task:
raise InvalidRequestError(
f"Job task mismatch: expected {task}, got {job.task}."
)
if task == "ocr" and not is_ocr_model(job.model):
raise InvalidRequestError(f"Job model is not an OCR model: {job.model}.")
if task == "document_parsing" and not is_document_parsing_model(job.model):
raise InvalidRequestError(
f"Job model is not a document parsing model: {job.model}."
)
return job.job_id
def extract_api_message_from_payload(payload: dict) -> Optional[str]:
for key in ("msg", "errorMsg", "message"):
value = payload.get(key)
if value:
return str(value)
data = payload.get("data")
if isinstance(data, dict):
value = data.get("errorMsg")
if value:
return str(value)
return None
View on GitHub (pinned to 2661c7c0ef)
Solutions
- Use the Job returned by the document-parsing create call for document-parsing follow-ups.
- Check job.model with is_document_parsing_model before dispatch.
- Store the job's task alongside its id when persisting, and reload faithfully.
Example fix
# before result = client.get_document_parsing_result(ocr_job) # ocr_job.model is PP-OCRv5 # after assert is_document_parsing_model(ocr_job.model) is False result = client.get_ocr_result(ocr_job) # correct endpoint
Defensive patterns
Strategy: type-guard
Type guard
from paddleocr._api_client.models import is_document_parsing_model
def job_is_doc_parsing(job) -> bool:
return job.task == "document_parsing" and is_document_parsing_model(job.model) Prevention
- Persist job.task and job.model together with job_id.
- Validate reconstructed Job objects against the endpoint you intend to call.
When it happens
Trigger: Passing a Job whose model is OCR-only to a document-parsing-scoped method (task='document_parsing').
Common situations: Reusing a Job object across endpoints, or constructing Job instances from persisted data where the model field no longer matches the document-parsing set.
Related errors
- Job model is not an OCR model: {job.model}.
- Unsupported OCR model: {model}
- Unsupported document parsing model: {model}
- Unsupported model: {model}
- PP-StructureV3 requires PPStructureV3Options.
AI-assisted analysis of PaddlePaddle/PaddleOCR@2661c7c0ef (2026-08-14).
Data as JSON: /api/errors/2848cc8d67f2c2d4.
Report an issue: GitHub.