{"record":{"id":"6042829c5ed7d0ef","repo":"PaddlePaddle/PaddleOCR","slug":"warnings-join-pipeline-warnings-promoted","errorCode":null,"errorMessage":"${warnings.join(\" \")} (pipeline warnings promoted to errors when warningBehavior=\"error\")","messagePattern":"(.+?) \\(pipeline warnings promoted to errors when warningBehavior=\"error\"\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"paddleocr-js/packages/core/src/pipelines/ocr/shared.ts","lineNumber":350,"sourceCode":"  }\n  if (explicitBatch.rec !== undefined) {\n    merged.textRecognitionBatchSize = explicitBatch.rec;\n  }\n  if (explicitBatch.pipeline !== undefined) {\n    merged.pipelineBatchSize = explicitBatch.pipeline;\n  }\n  return merged;\n}\n\nfunction resolveWarningBehavior(value: unknown): \"warn\" | \"ignore\" | \"error\" {\n  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,","sourceCodeStart":332,"sourceCodeEnd":368,"githubUrl":"https://github.com/PaddlePaddle/PaddleOCR/blob/2661c7c0ef5c613e8f93c6e93b2e052399f0f854/paddleocr-js/packages/core/src/pipelines/ocr/shared.ts#L332-L368","documentation":"The pipeline collects non-fatal configuration warnings (strings) while resolving options. Normally they are printed via console.warn with a [PaddleOCR.js] prefix, but if warningBehavior is set to 'error', emitPipelineWarnings() joins them and throws, turning every accumulated warning into a hard failure with the warning texts concatenated as the message.","triggerScenarios":"Setting warningBehavior: 'error' (in pipeline config or options) while the resolved configuration still produces at least one warning, e.g. a deprecated option or an ambiguous/implicit model selection that only warns by default.","commonSituations":"Teams enabling strict mode in CI to catch deprecated usage; upgrading the library where previously-tolerated config now emits warnings that fail the build once warningBehavior='error' is turned on.","solutions":["Read the thrown message: each sentence is one warning describing the exact config problem; fix each one.","Temporarily set warningBehavior to 'warn' to see the full list via console.warn and fix them one by one before re-enabling 'error'.","If a warning is a false positive for your setup, adjust the offending option rather than disabling strict mode globally."],"exampleFix":"// before\nconst ocr = await PaddleOCR.create({\n  pipelineConfig: { warningBehavior: 'error' },\n  // ... config that triggers a deprecation warning\n});\n\n// after\nconst ocr = await PaddleOCR.create({\n  pipelineConfig: { warningBehavior: 'error' },\n  // warning-triggering option corrected per the warning text\n});","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  const ocr = await PaddleOCR.create(opts);\n} catch (e) {\n  if (e instanceof Error && /warningBehavior/.test(e.message)) {\n    // each sentence in the message is one promoted warning; log and fix individually\n  } else {\n    throw e;\n  }\n}","preventionTips":["Run development builds with warningBehavior: 'warn' and fix all [PaddleOCR.js] console warnings before enabling 'error'.","Treat new console warnings after a library upgrade as future strict-mode failures."],"tags":["configuration","warnings","strict-mode","options"],"backgroundTag":null,"analyzedSha":"2661c7c0ef5c613e8f93c6e93b2e052399f0f854","analyzedAt":"2026-08-14T20:17:30.180Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}