PaddlePaddle/PaddleOCR · error
Unsupported lang/ocrVersion combination: lang="${lang}", ocr
Error message
Unsupported lang/ocrVersion combination: lang="${lang}", ocrVersion="${resolvedOcrVersion}". What it means
When resolving the default model selection from lang/ocrVersion, PP-OCRv6 is special-cased: only a restricted language list (isPpOcrV6Lang) is supported, because v6 ships a single multi-language model selection. If lang is not on that list, this error is thrown with both values shown.
Source
Thrown at paddleocr-js/packages/core/src/pipelines/ocr/shared.ts:530
}
function resolveBaseModelSelection(
options: Record<string, unknown>,
includeDefaultBase = false
): Readonly<PipelineModelSelection> | null {
const ocrVersion = readAliasedOption(options, ["ocrVersion", "ocr_version"], "ocrVersion") as
| string
| undefined;
if (!options.lang && !ocrVersion) {
return includeDefaultBase ? DEFAULT_MODEL_SELECTION : null;
}
const lang = (options.lang as string) || "ch";
const resolvedOcrVersion = ocrVersion || "PP-OCRv5";
if (resolvedOcrVersion === "PP-OCRv6") {
if (!isPpOcrV6Lang(lang)) {
throw new Error(
`Unsupported lang/ocrVersion combination: lang="${lang}", ocrVersion="${resolvedOcrVersion}".`
);
}
return PP_OCRV6_LANG_VERSION_MODEL_SELECTION;
}
const modelSelection = SUPPORTED_LANG_VERSION_MODELS.get(`${lang}::${resolvedOcrVersion}`);
if (!modelSelection) {
throw new Error(
`Unsupported lang/ocrVersion combination: lang="${lang}", ocrVersion="${resolvedOcrVersion}".`
);
}
return modelSelection;
}
function resolveConstructionOptions(
options: Record<string, unknown> = {}View on GitHub (pinned to 2661c7c0ef)
Solutions
- Use a lang supported by PP-OCRv6 (check the library's v6 language list / docs).
- Or downgrade ocrVersion to one covering your language, e.g. 'PP-OCRv5'.
- Or bypass lang-based selection entirely by specifying explicit model names for both roles.
Example fix
// before
const ocr = await PaddleOCR.create({ lang: 'korean', ocrVersion: 'PP-OCRv6' });
// after
const ocr = await PaddleOCR.create({ lang: 'korean', ocrVersion: 'PP-OCRv5' }); Defensive patterns
Strategy: validation
Validate before calling
// Check lang support for PP-OCRv6 against your pinned library version's list
const PP_OCRV6_LANGS = new Set(['ch', 'en', /* ...fill from your version's docs */]);
function isSupportedV6Lang(lang: string): boolean {
return PP_OCRV6_LANGS.has(lang);
}
if (opts.ocrVersion === 'PP-OCRv6' && !isSupportedV6Lang(opts.lang ?? 'ch')) {
opts = { ...opts, ocrVersion: 'PP-OCRv5' };
} Type guard
function isPpOcrV6Config(lang: string, version: string): boolean {
return version !== 'PP-OCRv6' || isSupportedV6Lang(lang);
} Try / catch
try {
const ocr = await PaddleOCR.create({ lang, ocrVersion });
} catch (e) {
if (e instanceof Error && e.message.includes('Unsupported lang/ocrVersion')) {
return PaddleOCR.create({ lang, ocrVersion: 'PP-OCRv5' }); // known-wide coverage fallback
}
throw e;
} Prevention
- Pin the library version and copy its v6 language list into your config validation.
- Default to PP-OCRv5 unless you specifically need v6 features.
When it happens
Trigger: PaddleOCR.create({ lang: 'korean', ocrVersion: 'PP-OCRv6' }) where 'korean' is not in the PP-OCRv6 language set (exact list defined by isPpOcrV6Lang in this version).
Common situations: Assuming every lang supported by PP-OCRv5 works on v6; upgrading ocrVersion without checking its language matrix; defaulting ocrVersion to the newest version while keeping an exotic lang.
Related errors
- Unknown model asset "${modelName}".
- ${modelRole} model selection must define model_name.
- ${modelRole} in inference.yml declares model_name "${declare
- OCR model selection must define both detection and recogniti
- text_detection_model_dir requires text_detection_model_name.
AI-assisted analysis of PaddlePaddle/PaddleOCR@2661c7c0ef (2026-08-14).
Data as JSON: /api/errors/aca9fb4e44d44104.
Report an issue: GitHub.