{"record":{"id":"1a8866b7a9cbd702","repo":"PaddlePaddle/PaddleOCR","slug":"entry-targetname-was-not-found-in-the-tar-arc","errorCode":null,"errorMessage":"Entry \"${targetName}\" was not found in the tar archive.","messagePattern":"Entry \"(.+?)\" was not found in the tar archive\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"paddleocr-js/packages/core/src/resources/tar.ts","lineNumber":79,"sourceCode":"  }\n\n  return entries;\n}\n\nexport function pickTarEntry(entries: Map<string, Uint8Array>, targetName: string): Uint8Array {\n  const normalizedTarget = normalizeEntryName(targetName);\n  const entry = entries.get(normalizedTarget);\n  if (entry) {\n    return entry;\n  }\n\n  for (const [name, value] of entries) {\n    if (name.endsWith(`/${normalizedTarget}`) || name === normalizedTarget) {\n      return value;\n    }\n  }\n\n  throw new Error(`Entry \"${targetName}\" was not found in the tar archive.`);\n}\n","sourceCodeStart":61,"sourceCodeEnd":81,"githubUrl":"https://github.com/PaddlePaddle/PaddleOCR/blob/2661c7c0ef5c613e8f93c6e93b2e052399f0f854/paddleocr-js/packages/core/src/resources/tar.ts#L61-L81","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["List the archive (tar -tf bundle.tar) and compare entry names with the expected entry paths for your package version","Repackage the tar so the model/config files sit at the expected names (top-level or as a suffix path)","Use the official bundle URLs shipped as DEFAULT_MODEL_ASSETS presets","Verify the downloaded byte size matches the published size to catch truncated files"],"exampleFix":"# before\ntar -tf custom.tar\n# weights.onnx  (unexpected name -> pickTarEntry throws)\n\n# after\ntar -tf custom.tar\n# inference.pdmodel\n# inference.yml","handlingStrategy":"validation","validationCode":"import { extractTarEntries } from \"@paddleocr/core/resources/tar\";\nfunction bundleHasEntries(url: string): Promise<boolean> {\n  return fetch(url).then(r => r.arrayBuffer()).then(buf => {\n    const entries = extractTarEntries(buf);\n    return entries.has(\"inference.pdmodel\") && entries.has(\"inference.yml\");\n  });\n}","typeGuard":null,"tryCatchPattern":"try {\n  const model = await loadModelAsset(asset);\n} catch (e) {\n  if (e instanceof Error && e.message.includes(\"not found in the tar archive\")) {\n    // re-download from official preset URL or repackage; do not retry same bundle\n  } else throw e;\n}","preventionTips":["tar -tf every custom bundle and diff entry names against expected paths","Keep entry filenames identical to official bundles when repackaging","Verify artifact checksums/sizes when mirroring models"],"tags":["tar","model","packaging","validation"],"backgroundTag":null,"analyzedSha":"2661c7c0ef5c613e8f93c6e93b2e052399f0f854","analyzedAt":"2026-08-14T20:17:30.180Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}