{"record":{"id":"fb6e39e620b4507a","repo":"PaddlePaddle/PaddleOCR","slug":"job-job-jobid-is-a-job-task-job-not-a-exp","errorCode":null,"errorMessage":"Job ${job.jobId} is a ${job.task} job, not a ${expectedTask} job.","messagePattern":"Job (.+?) is a (.+?) job, not a (.+?) job\\.","errorType":"exception","errorClass":"InvalidRequestError","httpStatus":null,"severity":"warning","filePath":"api_sdk/typescript/src/client.ts","lineNumber":338,"sourceCode":"          exports: isRecord(item.exports) ? item.exports : {},\n          markdown: item.markdown,\n          raw: item,\n        };\n      });\n    });\n    return { jobId, pages, dataInfo };\n  }\n\n  private resolveJob(job: Job | string, expectedTask: Job[\"task\"]): Job {\n    if (typeof job === \"string\") {\n      return {\n        jobId: job,\n        model: expectedTask === \"ocr\" ? Model.PPOCRv6 : Model.PaddleOCRVL16,\n        task: expectedTask,\n      };\n    }\n    if (job.task !== expectedTask) {\n      throw new InvalidRequestError(`Job ${job.jobId} is a ${job.task} job, not a ${expectedTask} job.`);\n    }\n    this.validateModelForTask(job.model, expectedTask);\n    return job;\n  }\n\n  private validateModelForTask(model: string, task: Job[\"task\"]): void {\n    if (task === \"ocr\" && !isOCRModel(model)) {\n      throw new InvalidRequestError(`Model ${model} is not an OCR model.`);\n    }\n    if (task === \"document_parsing\" && !isDocumentParsingModel(model)) {\n      throw new InvalidRequestError(`Model ${model} is not a document parsing model.`);\n    }\n  }\n}\n\nfunction stringMap(value: Record<string, unknown>): Record<string, string> {\n  const result: Record<string, string> = {};\n  for (const [key, val] of Object.entries(value)) {","sourceCodeStart":320,"sourceCodeEnd":356,"githubUrl":"https://github.com/PaddlePaddle/PaddleOCR/blob/2661c7c0ef5c613e8f93c6e93b2e052399f0f854/api_sdk/typescript/src/client.ts#L320-L356","documentation":"Raised as RequestTimeoutError from get_batch_status in paddleocr/_api_client/_http.py:179 when the GET to fetch batch status exceeds the configured HTTP timeout. Batches aggregate many jobs, so this endpoint can be slower than single-job status, especially with large batches. Only the read failed; batch processing continues server-side.","triggerScenarios":"Calling get_batch_status(batch_id) on a large batch (hundreds of jobs) or while the API is loaded, exceeding the client timeout.","commonSituations":"Big batch submissions; timeout configured for single-job calls; polling many batches concurrently, saturating egress; peak-hour latency.","solutions":["Increase the client timeout for batch status reads","Poll batches less frequently and stagger multiple batches","Retry the read — it is idempotent","Split very large batches into smaller ones if the endpoint stays slow"],"exampleFix":"# before\nclient = Client(api_key=..., timeout=15)\n# after\nclient = Client(api_key=..., timeout=60)","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"from paddleocr._api_client.errors import RequestTimeoutError\ntry:\n    batch = client.get_batch_status(batch_id)\nexcept RequestTimeoutError:\n    time.sleep(5)\n    batch = client.get_batch_status(batch_id)","preventionTips":["Give batch status reads a larger timeout than single-job reads","Stagger concurrent batch polls","Treat batch status as eventually consistent — poll, don't hammer"],"tags":["network","timeout","batch","polling","retryable"],"backgroundTag":null,"analyzedSha":"2661c7c0ef5c613e8f93c6e93b2e052399f0f854","analyzedAt":"2026-08-14T20:17:30.180Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}