{"record":{"id":"7edb36c2ac3e97cc","repo":"PaddlePaddle/PaddleOCR","slug":"unknown-model-asset-modelname","errorCode":null,"errorMessage":"Unknown model asset \"${modelName}\".","messagePattern":"Unknown model asset \"(.+?)\"\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"paddleocr-js/packages/core/src/pipelines/ocr/shared.ts","lineNumber":361,"sourceCode":"  if (value === \"ignore\" || value === \"error\") return value;\n  return \"warn\";\n}\n\nfunction emitPipelineWarnings(warnings: string[], behavior: \"warn\" | \"ignore\" | \"error\"): void {\n  if (!warnings.length || behavior === \"ignore\") return;\n  if (behavior === \"error\") {\n    throw new Error(warnings.join(\" \"));\n  }\n  for (const warning of warnings) {\n    console.warn(`[PaddleOCR.js] ${warning}`);\n  }\n}\n\nfunction resolveModelAssetByName(_modelRole: string, modelName: string): ModelAsset {\n  const asset = DEFAULT_MODEL_ASSETS[modelName];\n  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- runtime guard for missing Record key\n  if (!asset) {\n    throw new Error(`Unknown model asset \"${modelName}\".`);\n  }\n  return { url: asset.url };\n}\n\nfunction getSelectedModelName(\n  baseSelection: PipelineModelSelection | null,\n  configSelection: PipelineModelSelection | null,\n  explicitSelection: Record<string, string | null> | null,\n  selectionKey: keyof PipelineModelSelection\n): string | null {\n  return (\n    explicitSelection?.[selectionKey] ??\n    configSelection?.[selectionKey] ??\n    baseSelection?.[selectionKey] ??\n    null\n  );\n}\n","sourceCodeStart":343,"sourceCodeEnd":379,"githubUrl":"https://github.com/PaddlePaddle/PaddleOCR/blob/2661c7c0ef5c613e8f93c6e93b2e052399f0f854/paddleocr-js/packages/core/src/pipelines/ocr/shared.ts#L343-L379","documentation":"Model roles (detection, recognition, etc.) are resolved by looking the requested model_name up in the built-in DEFAULT_MODEL_ASSETS registry, which maps known model names to their hosted URLs. If the name is not a key in that registry, no download URL can be determined, so resolveModelAssetByName() throws rather than guessing a URL.","triggerScenarios":"Passing a model name that is not shipped with this version of the library, e.g. textDetectionModelName: 'PP-OCRv9_mobile_det' or a typo like 'pp-ocrv5_mobile_det' (lookup is exact and case-sensitive).","commonSituations":"Using a model name from newer upstream PaddleOCR docs than the installed paddleocr-js version supports; typos; assuming any HuggingFace model id works.","solutions":["Check the spelling and case of the model name against the library's exported model list / DEFAULT_MODEL_ASSETS keys.","Upgrade paddleocr-js to a version that ships the model you want.","If you host the model yourself, pass an explicit asset (e.g. text_detection_model_dir / a ModelAsset URL) together with the model name instead of relying on the default registry."],"exampleFix":"// before\nconst ocr = await PaddleOCR.create({\n  textDetectionModelName: 'PP-OCRv9_mobile_det'\n});\n\n// after\nconst ocr = await PaddleOCR.create({\n  textDetectionModelName: 'PP-OCRv5_mobile_det'\n});","handlingStrategy":"validation","validationCode":"// Validate model names against the names you know this version ships before create()\nconst KNOWN_MODELS = ['PP-OCRv5_mobile_det', 'PP-OCRv5_server_det', 'PP-OCRv5_mobile_rec', /* ... */];\nfunction isKnownModel(name: string): boolean {\n  return KNOWN_MODELS.includes(name);\n}","typeGuard":"function isValidModelName(name: unknown): name is string {\n  return typeof name === 'string' && /^[PP-OCRv\\d+_(mobile|server)(det|rec)]/i.test(name) !== undefined;\n}","tryCatchPattern":"try {\n  const ocr = await PaddleOCR.create(opts);\n} catch (e) {\n  if (e instanceof Error && e.message.startsWith('Unknown model asset')) {\n    // e.message contains the bad name; surface a config error to the user\n    throw new ConfigError(`Unsupported model: ${e.message}`);\n  }\n  throw e;\n}","preventionTips":["Pin the paddleocr-js version and derive supported model names from its docs/exports.","Add a startup config check listing allowed model names when users configure them."],"tags":["model-selection","configuration","versioning"],"backgroundTag":null,"analyzedSha":"2661c7c0ef5c613e8f93c6e93b2e052399f0f854","analyzedAt":"2026-08-14T20:17:30.180Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}