PaddlePaddle/PaddleOCR · critical · Error

${kind} model requires a non-empty ${MODEL_ENTRY_PATHS.confi

Error message

${kind} model requires a non-empty ${MODEL_ENTRY_PATHS.config} resource.

What it means

Thrown by assertModelResourceSlot() when the "config" slot is not a string or is whitespace-only after decoding. Every model bundle must ship a textual config entry (path MODEL_ENTRY_PATHS.config) alongside the model bytes; the runtime reads it to build the inference graph. An empty/missing config means the tar lacks the expected config file or it decoded to empty text.

Source

Thrown at paddleocr-js/packages/core/src/resources/model-asset.ts:111

}

// --- Model loading ---

export function getModelEntryPath(slot: string): string | null {
  return MODEL_ENTRY_PATHS[slot] || null;
}

export function assertModelResourceSlot(kind: string, slot: string, value: unknown): void {
  if (slot === "model") {
    if (!(value instanceof Uint8Array) || value.byteLength === 0) {
      throw new Error(`${kind} model requires a non-empty ${MODEL_ENTRY_PATHS.model} resource.`);
    }
    return;
  }

  if (slot === "config") {
    if (typeof value !== "string" || value.trim().length === 0) {
      throw new Error(`${kind} model requires a non-empty ${MODEL_ENTRY_PATHS.config} resource.`);
    }
    return;
  }

  throw new Error(`Unsupported model resource slot "${slot}".`);
}

export function assertModelResources(kind: string, resources: Record<string, unknown>): void {
  for (const [slot, value] of Object.entries(resources)) {
    assertModelResourceSlot(kind, slot, value);
  }
}

// --- Model loading (fetch + tar extraction) ---

import { extractTarEntries, pickTarEntry } from "./tar";

export async function loadModelAsset(

View on GitHub (pinned to 2661c7c0ef)

Solutions

  1. Inspect the tar (tar -tf bundle.tar) and confirm the config entry exists at the expected path with non-trivial size
  2. Re-download or re-package the bundle from official sources
  3. If generating resources yourself, decode the config entry into a non-empty string before passing to the runtime

Example fix

# before
# tar contains only weights, no config file -> assert fails

# after
# ensure the config entry exists:
tar -tf bundle.tar
# .../inference.yml  (non-empty)
# .../inference.pdmodel
Defensive patterns

Strategy: validation

Validate before calling

function isValidConfigSlot(v: unknown): boolean {
  return typeof v === "string" && v.trim().length > 0;
}

Type guard

function isNonEmptyText(v: unknown): v is string {
  return typeof v === "string" && v.trim().length > 0;
}

Prevention

When it happens

Trigger: A tar bundle that omits the config entry file; a config file that is empty or all whitespace; binary garbage placed at the config path so TextDecoder output is empty; hand-built resources where configText was never populated.

Common situations: Repackaging official models and forgetting the .yml/.json config; a proxy rewriting or truncating text assets; version mismatch where the entry filename changed between releases.

Related errors


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