{"record":{"id":"bd4bd05ffeddc4a4","repo":"PaddlePaddle/PaddleOCR","slug":"paddleocrcore-requires-pre-resolved-detection-and","errorCode":null,"errorMessage":"PaddleOCRCore requires pre-resolved detection and recognition asset descriptors.","messagePattern":"PaddleOCRCore requires pre-resolved detection and recognition asset descriptors\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"paddleocr-js/packages/core/src/pipelines/ocr/core.ts","lineNumber":86,"sourceCode":"\nexport interface OcrPipelineRunnerOptions {\n  pipelineConfig: NormalizedPipelineConfig;\n  ortOptions?: OrtOptions | NormalizedOrtOptions;\n  fetch?: typeof fetch;\n  ensureServedFromHttp?: EnsureServedFromHttpFn;\n  sourceToMat?: SourceToMatFn;\n}\n\nfunction noopEnsureServedFromHttp(): void {}\n\nfunction getResolvedAssets(assets: Partial<Record<string, ModelAsset>> | undefined): {\n  det: ModelAsset;\n  rec: ModelAsset;\n} {\n  const det = assets?.det;\n  const rec = assets?.rec;\n  if (!det || typeof det !== \"object\" || !rec || typeof rec !== \"object\") {\n    throw new Error(\n      \"PaddleOCRCore requires pre-resolved detection and recognition asset descriptors.\"\n    );\n  }\n  return { det, rec };\n}\n\nexport class OcrPipelineRunner {\n  protected options: OcrPipelineRunnerOptions;\n  protected modelConfig: OcrModelConfig;\n  protected runtimeDefaults: Partial<OcrRuntimeParamsInput>;\n  protected cv: OpenCv | null;\n  protected ort: OrtModule | null;\n  protected detModel: DetModel | null;\n  protected recModel: RecModel | null;\n  protected webgpuState: WebGpuState;\n  protected pipelineConfig: NormalizedPipelineConfig;\n  protected lastInitializationSummary: InitializationSummary | null;\n  private ensureServedFromHttp: EnsureServedFromHttpFn;","sourceCodeStart":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/PaddlePaddle/PaddleOCR/blob/2661c7c0ef5c613e8f93c6e93b2e052399f0f854/paddleocr-js/packages/core/src/pipelines/ocr/core.ts#L68-L104","documentation":"Thrown by getResolvedAssets() in OcrPipelineCore: the assets record must contain usable det and rec ModelAsset objects before core construction. The core does not resolve or download models itself — it expects the caller (usually the config normalization + loader layer) to have already resolved asset descriptors for both models. Missing either one aborts construction immediately.","triggerScenarios":"Constructing PaddleOCRCore directly with assets: { det: {...} } (rec missing), with nullish entries, or with non-object values; building the assets record from a config where one module's model_dir was null so no asset was produced.","commonSituations":"Bypassing the high-level pipeline factory and wiring the core by hand; a loader step silently skipping a failed asset resolution so the record ends up half-populated; passing the raw config object where a resolved-assets record is expected.","solutions":["Use the provided high-level loader/factory that runs normalizeOcrPipelineConfig and resolves both det and rec assets for you","If constructing manually, verify assets.det and assets.rec are both non-null objects before calling the constructor","Trace why one asset is missing — usually the corresponding module's model_dir/model_name in the config was incomplete"],"exampleFix":"// before\nnew PaddleOCRCore({ assets: { det: detAsset } }); // throws: rec missing\n\n// after\nnew PaddleOCRCore({ assets: { det: detAsset, rec: recAsset } });","handlingStrategy":"validation","validationCode":"function isModelAsset(v: unknown): v is { url?: string } {\n  return typeof v === \"object\" && v !== null;\n}\nif (!isModelAsset(assets?.det) || !isModelAsset(assets?.rec)) {\n  throw new Error(\"Both det and rec assets must be resolved before constructing the core\");\n}","typeGuard":"function hasResolvedDetRec(assets: Partial<Record<string, unknown>> | undefined): assets is { det: object; rec: object } {\n  return typeof assets?.det === \"object\" && assets.det !== null && typeof assets?.rec === \"object\" && assets.rec !== null;\n}","tryCatchPattern":null,"preventionTips":["Use the high-level factory/loader that resolves assets from config instead of constructing the core manually","Assert both assets exist right after the resolve step, so failures point at the loader","Treat a half-resolved assets record as a loader bug, not a core bug"],"tags":["paddleocr","lifecycle","model-asset","validation","construction"],"backgroundTag":null,"analyzedSha":"2661c7c0ef5c613e8f93c6e93b2e052399f0f854","analyzedAt":"2026-08-14T20:17:30.180Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}