{"record":{"id":"9545c0993a91316f","repo":"PaddlePaddle/PaddleOCR","slug":"conflicting-values-provided-for-label-aliase","errorCode":null,"errorMessage":"Conflicting values provided for ${label}: ${aliases.join(\", \")}.","messagePattern":"Conflicting values provided for (.+?): (.+?)\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"paddleocr-js/packages/core/src/pipelines/ocr/shared.ts","lineNumber":186,"sourceCode":"\nfunction readAliasedOption(\n  options: Record<string, unknown>,\n  aliases: string[],\n  label: string\n): unknown {\n  let resolved: unknown;\n  let hasResolvedValue = false;\n\n  for (const alias of aliases) {\n    if (!(alias in options)) continue;\n    const value = options[alias];\n    if (!hasResolvedValue) {\n      resolved = value;\n      hasResolvedValue = true;\n      continue;\n    }\n    if (value !== resolved) {\n      throw new Error(`Conflicting values provided for ${label}: ${aliases.join(\", \")}.`);\n    }\n  }\n\n  return hasResolvedValue ? resolved : undefined;\n}\n\nfunction isLimitType(value: unknown): value is LimitType {\n  return value === \"min\" || value === \"max\";\n}\n\nfunction overlayPipelineRuntimeDefaults(\n  base: PipelineRuntimeDefaults,\n  explicit: Partial<PipelineRuntimeDefaults>\n): PipelineRuntimeDefaults {\n  const next: Record<string, unknown> = { ...base };\n  for (const key of Object.keys(explicit) as Array<keyof PipelineRuntimeDefaults>) {\n    const value = explicit[key];\n    if (value === undefined) continue;","sourceCodeStart":168,"sourceCodeEnd":204,"githubUrl":"https://github.com/PaddlePaddle/PaddleOCR/blob/2661c7c0ef5c613e8f93c6e93b2e052399f0f854/paddleocr-js/packages/core/src/pipelines/ocr/shared.ts#L168-L204","documentation":"Many OCR pipeline options accept multiple aliases (snake_case and camelCase, or shorthand names), for example text_detection_model_name / textDetectionModelName. readAliasedOption() walks the aliases in order; if two aliases of the same option are both present and their values differ, the conflict is ambiguous and the library throws instead of picking one arbitrarily.","triggerScenarios":"Passing an options object containing two aliases of the same logical option with different values, e.g. { lang: 'en', lang: ... } style conflicts such as { text_detection_model_name: 'A', textDetectionModelName: 'B' } or { ocrVersion: 'PP-OCRv4', ocr_version: 'PP-OCRv5' } to create()/pipeline config resolution.","commonSituations":"Merging a config object loaded from a YAML/JSON file (snake_case) with programmatically built options (camelCase); copy-pasting examples that use different naming conventions into one call.","solutions":["Search your options object for both spellings of the option named in the error message (the message lists the conflicting aliases) and delete all but one.","Normalize your config to a single naming convention (prefer camelCase for JS) before passing it in.","If merging configs, make sure earlier sources are stripped of aliases before merging rather than shallow-merged."],"exampleFix":"// before\nconst ocr = await PaddleOCR.create({\n  text_detection_model_name: 'PP-OCRv5_server_det',\n  textDetectionModelName: 'PP-OCRv5_mobile_det'\n});\n\n// after\nconst ocr = await PaddleOCR.create({\n  textDetectionModelName: 'PP-OCRv5_mobile_det'\n});","handlingStrategy":"validation","validationCode":"// Reject option objects that carry conflicting aliases before calling create()\nconst ALIAS_GROUPS = [\n  ['textDetectionModelName', 'text_detection_model_name'],\n  ['textRecognitionModelName', 'text_recognition_model_name'],\n  ['textDetectionModelDir', 'text_detection_model_dir'],\n  ['textRecognitionModelDir', 'text_recognition_model_dir'],\n  ['ocrVersion', 'ocr_version']\n];\nfunction findAliasConflicts(o: Record<string, unknown>): string[] {\n  return ALIAS_GROUPS\n    .filter(g => g.every(k => o[k] !== undefined) && o[g[0]] !== o[g[1]])\n    .map(g => g.join(' vs '));\n}","typeGuard":"function hasNoAliasConflicts(o: Record<string, unknown>, groups: string[][]): boolean {\n  return groups.every(g => {\n    const present = g.filter(k => o[k] !== undefined);\n    return present.length < 2 || g.every(k => o[k] === o[present[0]]);\n  });\n}","tryCatchPattern":"try {\n  const ocr = await PaddleOCR.create(options);\n} catch (e) {\n  if (e instanceof Error && e.message.startsWith('Conflicting values provided for')) {\n    // message names the label and the alias list: normalize to camelCase and retry once\n    options = toCamelCaseOptions(options);\n    return PaddleOCR.create(options);\n  }\n  throw e;\n}","preventionTips":["Normalize every external config (YAML/JSON) to camelCase at the app boundary before it reaches the library.","Never shallow-merge two configs that use different naming conventions."],"tags":["configuration","aliases","validation","options"],"backgroundTag":null,"analyzedSha":"2661c7c0ef5c613e8f93c6e93b2e052399f0f854","analyzedAt":"2026-08-14T20:17:30.180Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}