{"record":{"id":"2848cc8d67f2c2d4","repo":"PaddlePaddle/PaddleOCR","slug":"job-model-is-not-a-document-parsing-model-job-mo","errorCode":null,"errorMessage":"Job model is not a document parsing model: {job.model}.","messagePattern":"Job model is not a document parsing model: (.+?)\\.","errorType":"validation","errorClass":"InvalidRequestError","httpStatus":null,"severity":"error","filePath":"paddleocr/_api_client/_core.py","lineNumber":100,"sourceCode":"        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\ndef job_id_for_task(job: Union[Job, str], task: str) -> str:\n    if isinstance(job, str):\n        return job\n    if job.task != task:\n        raise InvalidRequestError(\n            f\"Job task mismatch: expected {task}, got {job.task}.\"\n        )\n    if task == \"ocr\" and not is_ocr_model(job.model):\n        raise InvalidRequestError(f\"Job model is not an OCR model: {job.model}.\")\n    if task == \"document_parsing\" and not is_document_parsing_model(job.model):\n        raise InvalidRequestError(\n            f\"Job model is not a document parsing model: {job.model}.\"\n        )\n    return job.job_id\n\n\ndef extract_api_message_from_payload(payload: dict) -> Optional[str]:\n    for key in (\"msg\", \"errorMsg\", \"message\"):\n        value = payload.get(key)\n        if value:\n            return str(value)\n    data = payload.get(\"data\")\n    if isinstance(data, dict):\n        value = data.get(\"errorMsg\")\n        if value:\n            return str(value)\n    return None\n\n","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/PaddlePaddle/PaddleOCR/blob/2661c7c0ef5c613e8f93c6e93b2e052399f0f854/paddleocr/_api_client/_core.py#L82-L118","documentation":"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.","triggerScenarios":"Passing a Job whose model is OCR-only to a document-parsing-scoped method (task='document_parsing').","commonSituations":"Reusing a Job object across endpoints, or constructing Job instances from persisted data where the model field no longer matches the document-parsing set.","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."],"exampleFix":"# before\nresult = client.get_document_parsing_result(ocr_job)  # ocr_job.model is PP-OCRv5\n\n# after\nassert is_document_parsing_model(ocr_job.model) is False\nresult = client.get_ocr_result(ocr_job)  # correct endpoint","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"from paddleocr._api_client.models import is_document_parsing_model\n\ndef job_is_doc_parsing(job) -> bool:\n    return job.task == \"document_parsing\" and is_document_parsing_model(job.model)","tryCatchPattern":null,"preventionTips":["Persist job.task and job.model together with job_id.","Validate reconstructed Job objects against the endpoint you intend to call."],"tags":["validation","job","model","client-side"],"backgroundTag":null,"analyzedSha":"2661c7c0ef5c613e8f93c6e93b2e052399f0f854","analyzedAt":"2026-08-14T20:17:30.180Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}