PaddlePaddle/PaddleOCR · warning · InvalidRequestError

Model ${model} is not an OCR model.

Error message

Model ${model} is not an OCR model.

What it means

Raised as NetworkError from get_batch_status in paddleocr/_api_client/_http.py:181 when the batch status GET fails at the connection layer. Identical failure family to single-job NetworkError but on the batch endpoint; batch execution is unaffected server-side. Safe to retry since it is a read.

Source

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

  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)) {
    if (typeof val === "string") {
      result[key] = val;
    }
  }
  return result;
}

function isRecord(value: unknown): value is Record<string, unknown> {

View on GitHub (pinned to 2661c7c0ef)

Solutions

  1. Retry with backoff — idempotent read
  2. Persist the batchId so polling survives restarts
  3. Verify connectivity if errors cluster
  4. Stagger concurrent batch polls to reduce connection churn
Defensive patterns

Strategy: retry

Try / catch

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

Prevention

When it happens

Trigger: get_batch_status(batch_id) during connection drops, DNS failures, proxy resets, or TLS issues.

Common situations: Long-lived batch polling sessions over unstable networks; environment-level egress problems; proxy idle-connection teardown between polls.

Related errors


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