PaddlePaddle/PaddleOCR · error · ResultParseError

OCR result item is missing result.ocrResults.

Error message

OCR result item is missing result.ocrResults.

What it means

Raised as RequestTimeoutError from submit_file in paddleocr/_api_client/_http.py:153 when the multipart POST uploading a local file exceeds the configured HTTP timeout. File uploads are the slowest request type; large documents on slow uplinks routinely exceed small timeouts. The upload was aborted; the server may or may not have created the job.

Source

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

    if (req.fileUrl) {
      return this.http.submitUrl(model, req.fileUrl, payload, {
        pageRanges: req.pageRanges,
        batchId: req.batchId,
        signal,
      });
    }
    return this.http.submitFile(model, req.filePath!, payload, {
      pageRanges: req.pageRanges,
      batchId: req.batchId,
      signal,
    });
  }

  private parseOCRResult(jobId: string, jsonlData: unknown[]): OCRResult {
    const dataInfo: Record<string, unknown> = {};
    const pages = jsonlData.flatMap((lineObj) => {
      if (!isRecord(lineObj) || !isRecord(lineObj.result) || !Array.isArray(lineObj.result.ocrResults)) {
        throw new ResultParseError("OCR result item is missing result.ocrResults.");
      }
      if (isRecord(lineObj.result.dataInfo)) {
        Object.assign(dataInfo, lineObj.result.dataInfo);
      }
      return lineObj.result.ocrResults.map((item) => {
        if (!isRecord(item) || !("prunedResult" in item)) {
          throw new ResultParseError("OCR result page is missing prunedResult.");
        }
        return {
          prunedResult: item.prunedResult,
          ocrImageUrl: typeof item.ocrImage === "string" ? item.ocrImage : undefined,
          docPreprocessingImageUrl: typeof item.docPreprocessingImage === "string" ? item.docPreprocessingImage : undefined,
          inputImageUrl: typeof item.inputImage === "string" ? item.inputImage : undefined,
          raw: item,
        };
      });
    });
    return { jobId, pages, dataInfo };

View on GitHub (pinned to 2661c7c0ef)

Solutions

  1. Increase the client timeout substantially for uploads (e.g. 300s)
  2. Compress/downsample the document before upload (smaller PDFs, reduced DPI)
  3. Prefer submit_url with a publicly accessible file URL for very large files
  4. Retry; if worried about duplicate jobs, verify via batch/job listing after a timeout

Example fix

# before
client = Client(api_key=..., timeout=30)
# after
client = Client(api_key=..., timeout=300)
Defensive patterns

Strategy: retry

Validate before calling

import os

size_mb = os.path.getsize(file_path) / 1e6
if size_mb > 50:
    print("Large upload: consider a higher client timeout or submit_url")

Try / catch

from paddleocr._api_client.errors import RequestTimeoutError
for attempt in range(3):
    try:
        job_id = client.submit_file(model, file_path, {})
        break
    except RequestTimeoutError:
        if attempt == 2:
            raise

Prevention

When it happens

Trigger: client.submit_file(...) with a large file (tens/hundreds of MB) or slow upload bandwidth where total POST time exceeds the client timeout.

Common situations: Uploading high-resolution scans or big PDFs on constrained networks; default timeout tuned for API calls, not transfers; running from regions far from the API endpoint.

Related errors


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