PaddlePaddle/PaddleOCR · error
Conflicting values provided for ${label}: ${aliases.join(",
Error message
Conflicting values provided for ${label}: ${aliases.join(", ")}. What it means
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.
Source
Thrown at paddleocr-js/packages/core/src/pipelines/ocr/shared.ts:186
function readAliasedOption(
options: Record<string, unknown>,
aliases: string[],
label: string
): unknown {
let resolved: unknown;
let hasResolvedValue = false;
for (const alias of aliases) {
if (!(alias in options)) continue;
const value = options[alias];
if (!hasResolvedValue) {
resolved = value;
hasResolvedValue = true;
continue;
}
if (value !== resolved) {
throw new Error(`Conflicting values provided for ${label}: ${aliases.join(", ")}.`);
}
}
return hasResolvedValue ? resolved : undefined;
}
function isLimitType(value: unknown): value is LimitType {
return value === "min" || value === "max";
}
function overlayPipelineRuntimeDefaults(
base: PipelineRuntimeDefaults,
explicit: Partial<PipelineRuntimeDefaults>
): PipelineRuntimeDefaults {
const next: Record<string, unknown> = { ...base };
for (const key of Object.keys(explicit) as Array<keyof PipelineRuntimeDefaults>) {
const value = explicit[key];
if (value === undefined) continue;View on GitHub (pinned to 2661c7c0ef)
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.
Example fix
// before
const ocr = await PaddleOCR.create({
text_detection_model_name: 'PP-OCRv5_server_det',
textDetectionModelName: 'PP-OCRv5_mobile_det'
});
// after
const ocr = await PaddleOCR.create({
textDetectionModelName: 'PP-OCRv5_mobile_det'
}); Defensive patterns
Strategy: validation
Validate before calling
// Reject option objects that carry conflicting aliases before calling create()
const ALIAS_GROUPS = [
['textDetectionModelName', 'text_detection_model_name'],
['textRecognitionModelName', 'text_recognition_model_name'],
['textDetectionModelDir', 'text_detection_model_dir'],
['textRecognitionModelDir', 'text_recognition_model_dir'],
['ocrVersion', 'ocr_version']
];
function findAliasConflicts(o: Record<string, unknown>): string[] {
return ALIAS_GROUPS
.filter(g => g.every(k => o[k] !== undefined) && o[g[0]] !== o[g[1]])
.map(g => g.join(' vs '));
} Type guard
function hasNoAliasConflicts(o: Record<string, unknown>, groups: string[][]): boolean {
return groups.every(g => {
const present = g.filter(k => o[k] !== undefined);
return present.length < 2 || g.every(k => o[k] === o[present[0]]);
});
} Try / catch
try {
const ocr = await PaddleOCR.create(options);
} catch (e) {
if (e instanceof Error && e.message.startsWith('Conflicting values provided for')) {
// message names the label and the alias list: normalize to camelCase and retry once
options = toCamelCaseOptions(options);
return PaddleOCR.create(options);
}
throw e;
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- worker mode does not support a custom fetch implementation.
- ${warnings.join(" ")} (pipeline warnings promoted to errors
- ${modelRole} model selection must define model_name.
- OCR model selection must define both detection and recogniti
- worker must be a boolean or an options object.
AI-assisted analysis of PaddlePaddle/PaddleOCR@2661c7c0ef (2026-08-14).
Data as JSON: /api/errors/9545c0993a91316f.
Report an issue: GitHub.