PaddlePaddle/PaddleOCR · critical · Error

Entry "${targetName}" was not found in the tar archive.

Error message

Entry "${targetName}" was not found in the tar archive.

What it means

Thrown by pickTarEntry() in tar.ts when the requested entry name cannot be found in the parsed tar archive - neither as an exact normalized match nor as a path suffix (name.endsWith("/" + target)). The loader picks MODEL_ENTRY_PATHS.model and .config out of the bundle, so this means the tar parsed fine but does not contain the expected file name, e.g. a differently-named or empty archive.

Source

Thrown at paddleocr-js/packages/core/src/resources/tar.ts:79

  }

  return entries;
}

export function pickTarEntry(entries: Map<string, Uint8Array>, targetName: string): Uint8Array {
  const normalizedTarget = normalizeEntryName(targetName);
  const entry = entries.get(normalizedTarget);
  if (entry) {
    return entry;
  }

  for (const [name, value] of entries) {
    if (name.endsWith(`/${normalizedTarget}`) || name === normalizedTarget) {
      return value;
    }
  }

  throw new Error(`Entry "${targetName}" was not found in the tar archive.`);
}

View on GitHub (pinned to 2661c7c0ef)

Solutions

  1. List the archive (tar -tf bundle.tar) and compare entry names with the expected entry paths for your package version
  2. Repackage the tar so the model/config files sit at the expected names (top-level or as a suffix path)
  3. Use the official bundle URLs shipped as DEFAULT_MODEL_ASSETS presets
  4. Verify the downloaded byte size matches the published size to catch truncated files

Example fix

# before
tar -tf custom.tar
# weights.onnx  (unexpected name -> pickTarEntry throws)

# after
tar -tf custom.tar
# inference.pdmodel
# inference.yml
Defensive patterns

Strategy: validation

Validate before calling

import { extractTarEntries } from "@paddleocr/core/resources/tar";
function bundleHasEntries(url: string): Promise<boolean> {
  return fetch(url).then(r => r.arrayBuffer()).then(buf => {
    const entries = extractTarEntries(buf);
    return entries.has("inference.pdmodel") && entries.has("inference.yml");
  });
}

Try / catch

try {
  const model = await loadModelAsset(asset);
} catch (e) {
  if (e instanceof Error && e.message.includes("not found in the tar archive")) {
    // re-download from official preset URL or repackage; do not retry same bundle
  } else throw e;
}

Prevention

When it happens

Trigger: Downloading a tar whose internal layout differs (weights named inference.pdmodel vs model.onnx); a tar containing a single directory prefix mismatch; a 200-response that is actually a different artifact (docs tar, source tar); zero-entry tar from a truncated but status-ok response.

Common situations: Mixing Paddle2ONNX-converted bundles with native paddle bundles; self-packaging with renamed files; mirrors serving wrong artifacts; upstream changing entry filenames across versions while the client pins old expectations.

Related errors


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