PaddlePaddle/PaddleOCR · warning · InvalidRequestError

Job ${job.jobId} is a ${job.task} job, not a ${expectedTask}

Error message

Job ${job.jobId} is a ${job.task} job, not a ${expectedTask} job.

What it means

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.

Source

Thrown at api_sdk/typescript/src/client.ts:338

          exports: isRecord(item.exports) ? item.exports : {},
          markdown: item.markdown,
          raw: item,
        };
      });
    });
    return { jobId, pages, dataInfo };
  }

  private resolveJob(job: Job | string, expectedTask: Job["task"]): Job {
    if (typeof job === "string") {
      return {
        jobId: job,
        model: expectedTask === "ocr" ? Model.PPOCRv6 : Model.PaddleOCRVL16,
        task: expectedTask,
      };
    }
    if (job.task !== expectedTask) {
      throw new InvalidRequestError(`Job ${job.jobId} is a ${job.task} job, not a ${expectedTask} job.`);
    }
    this.validateModelForTask(job.model, expectedTask);
    return job;
  }

  private validateModelForTask(model: string, task: Job["task"]): void {
    if (task === "ocr" && !isOCRModel(model)) {
      throw new InvalidRequestError(`Model ${model} is not an OCR model.`);
    }
    if (task === "document_parsing" && !isDocumentParsingModel(model)) {
      throw new InvalidRequestError(`Model ${model} is not a document parsing model.`);
    }
  }
}

function stringMap(value: Record<string, unknown>): Record<string, string> {
  const result: Record<string, string> = {};
  for (const [key, val] of Object.entries(value)) {

View on GitHub (pinned to 2661c7c0ef)

Solutions

  1. Increase the client timeout for batch status reads
  2. Poll batches less frequently and stagger multiple batches
  3. Retry the read — it is idempotent
  4. Split very large batches into smaller ones if the endpoint stays slow

Example fix

# before
client = Client(api_key=..., timeout=15)
# after
client = Client(api_key=..., timeout=60)
Defensive patterns

Strategy: retry

Try / catch

from paddleocr._api_client.errors import RequestTimeoutError
try:
    batch = client.get_batch_status(batch_id)
except RequestTimeoutError:
    time.sleep(5)
    batch = client.get_batch_status(batch_id)

Prevention

When it happens

Trigger: Calling get_batch_status(batch_id) on a large batch (hundreds of jobs) or while the API is loaded, exceeding the client timeout.

Common situations: Big batch submissions; timeout configured for single-job calls; polling many batches concurrently, saturating egress; peak-hour latency.

Related errors


AI-assisted analysis of PaddlePaddle/PaddleOCR@2661c7c0ef (2026-08-14). Data as JSON: /api/errors/fb6e39e620b4507a. Report an issue: GitHub.