{"record":{"id":"dd89a7be8eada5ff","repo":"PaddlePaddle/PaddleOCR","slug":"job-job-id-failed-error-msg","errorCode":null,"errorMessage":"Job {job_id} failed: {error_msg}","messagePattern":"Job (.+?) failed: (.+?)","errorType":"exception","errorClass":"JobFailedError","httpStatus":null,"severity":"error","filePath":"paddleocr/_api_client/_async_poller.py","lineNumber":72,"sourceCode":"        start = loop.time()\n        deadline = start + self._max_wait_time\n\n        while True:\n            now = loop.time()\n            if now >= deadline:\n                raise PollTimeoutError(job_id, now - start)\n\n            data = await self._http.get_job_status(job_id)\n            state = validate_state(data)\n\n            if state == \"done\":\n                json_url = validate_result_json_url(data)\n                jsonl_data = await self._http.fetch_jsonl(json_url)\n                return jsonl_data, data\n\n            if state == \"failed\":\n                error_msg = data.get(\"errorMsg\", \"Unknown error\")\n                raise JobFailedError(job_id, error_msg)\n\n            remaining = deadline - loop.time()\n            if remaining <= 0:\n                raise PollTimeoutError(job_id, loop.time() - start)\n            await asyncio.sleep(min(interval, remaining))\n            interval = min(interval * self._multiplier, self._max_interval)\n\n    async def get_status(self, job_id: str) -> JobStatus:\n        data = await self._http.get_job_status(job_id)\n        return job_status_from_data(job_id, data)\n\n    async def get_batch_status(self, batch_id: str) -> BatchStatus:\n        data = await self._http.get_batch_status(batch_id)\n        return parse_batch_status(batch_id, data)\n","sourceCodeStart":54,"sourceCodeEnd":87,"githubUrl":"https://github.com/PaddlePaddle/PaddleOCR/blob/2661c7c0ef5c613e8f93c6e93b2e052399f0f854/paddleocr/_api_client/_async_poller.py#L54-L87","documentation":"Raised as JobFailedError by the async poller when a submitted job's state transitions to 'failed' on the service side. The message embeds the job_id and the service-provided errorMsg (or 'Unknown error' when the payload omits it). This means the request was accepted but processing failed downstream, so retrying with identical inputs often fails again.","triggerScenarios":"Calling an async API method that polls to completion (e.g. create OCR/document-parsing job then wait) where get_job_status() eventually returns state == 'failed'. The payload's errorMsg field supplies the reason; if absent, 'Unknown error' is used.","commonSituations":"Corrupt or unreadable input file at the given file_url, unsupported file format or oversized document, model mismatch for the input type, or transient service-side failures during extraction. Also seen when the uploaded URL expires before the service fetches it.","solutions":["Read the errorMsg embedded in the exception to identify the service-side reason before changing anything.","Verify the input file: open the file_url/file_path locally, confirm it is a supported format and not truncated.","Check that the model and options match the input (e.g. document-parsing model for PDFs, OCR model for images).","Retry once with a fresh job after fixing the input; if errorMsg indicates a transient internal error, recreate the job with the same input.","If failures persist, capture job_id and errorMsg and report to PaddleOCR AI Studio support."],"exampleFix":"// before\nresult = await client.ocr(file_path=\"doc.pdf\")  # raises JobFailedError\n\n// after\ntry:\n    result = await client.ocr(file_path=\"doc.pdf\")\nexcept JobFailedError as e:\n    print(f\"job {e.job_id} failed: {e.message}\")\n    # inspect input file / model choice, then resubmit","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"from paddleocr._api_client.errors import JobFailedError\ntry:\n    result = await client.ocr(file_path=path)\nexcept JobFailedError as e:\n    # e.job_id and str(e) carry the service-side reason\n    log.warning(\"job %s failed: %s\", e.job_id, e)\n    raise","preventionTips":["Validate the file opens and is a supported format before submitting.","Match the model to the input type (OCR for images, document parsing for PDFs).","Log errorMsg from every JobFailedError to catch recurring input problems."],"tags":["async","job","polling","api"],"backgroundTag":null,"analyzedSha":"2661c7c0ef5c613e8f93c6e93b2e052399f0f854","analyzedAt":"2026-08-14T20:17:30.180Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}