{"record":{"id":"86a8fc53c911dac8","repo":"ocrmypdf/OCRmyPDF","slug":"ocr-engine-does-not-have-language-data-for-the-fol","errorCode":null,"errorMessage":"OCR engine does not have language data for the following requested languages: \\n{lang_text}\\nPlease install the appropriate language data for your OCR engine.\\n\\nSee the online documentation for instructions:\\n    https://ocrmypdf.readthedocs.io/en/latest/languages.html\\n\\nNote: most languages are identified by a 3-letter ISO 639-2 Code.\\nFor example, English is 'eng', German is 'deu', and Spanish is 'spa'.Simplified Chinese is 'chi_sim' and Traditional Chinese is 'chi_tra'.\\n","messagePattern":"OCR engine does not have language data for the following requested languages: \\\\n(.+?)\\\\nPlease install the appropriate language data for your OCR engine\\.\\\\n\\\\nSee the online documentation for instructions:\\\\n    https://ocrmypdf\\.readthedocs\\.io/en/latest/languages\\.html\\\\n\\\\nNote: most languages are identified by a 3-letter ISO 639-2 Code\\.\\\\nFor example, English is 'eng', German is 'deu', and Spanish is 'spa'\\.Simplified Chinese is 'chi_sim' and Traditional Chinese is 'chi_tra'\\.\\\\n","errorType":"error_code","errorClass":"MissingDependencyError","httpStatus":null,"severity":"error","filePath":"src/ocrmypdf/_validation.py","lineNumber":86,"sourceCode":"\n    missing_languages = set(options.languages) - set(ocr_engine_languages)\n    if missing_languages:\n        lang_text = '\\n'.join(lang for lang in missing_languages)\n        msg = (\n            \"OCR engine does not have language data for the following \"\n            \"requested languages: \\n\"\n            f\"{lang_text}\\n\"\n            \"Please install the appropriate language data for your OCR engine.\\n\"\n            \"\\n\"\n            \"See the online documentation for instructions:\\n\"\n            \"    https://ocrmypdf.readthedocs.io/en/latest/languages.html\\n\"\n            \"\\n\"\n            \"Note: most languages are identified by a 3-letter ISO 639-2 Code.\\n\"\n            \"For example, English is 'eng', German is 'deu', and Spanish is 'spa'.\\n\"\n            \"Simplified Chinese is 'chi_sim' and Traditional Chinese is 'chi_tra'.\"\n            \"\\n\"\n        )\n        raise MissingDependencyError(msg)\n\n\ndef check_options_sidecar(options: OcrOptions) -> None:\n    if options.sidecar == '\\0':\n        if options.output_file == '-':\n            raise BadArgsError(\"--sidecar filename needed when output file is stdout.\")\n        elif options.output_file == os.devnull:\n            raise BadArgsError(\n                \"--sidecar filename needed when output file is /dev/null or NUL.\"\n            )\n        elif not isinstance(options.output_file, str | Path):\n            # The '\\0' sentinel is only ever set by the CLI, which always\n            # supplies output_file as a plain path - not a stream. If this\n            # somehow fires, the caller mixed a CLI-only sentinel with the\n            # stream-based API.\n            raise BadArgsError(\n                \"--sidecar filename needed when output file is not a path.\"\n            )","sourceCodeStart":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/ocrmypdf/OCRmyPDF/blob/5074a0b0e109362422b768fd271ed84bf717c4ec/src/ocrmypdf/_validation.py#L68-L104","documentation":"Raised when one or more requested OCR languages are not installed for the OCR engine (Tesseract). The message lists the missing codes and points to the language documentation.","triggerScenarios":"options.languages containing codes absent from the engine's available language set, e.g. -l deu when only eng tessdata is installed; raised as MissingDependencyError in check_options_languages.","commonSituations":"Fresh Tesseract installs without extra language packs; typo'd codes like 'de' instead of 'deu' or 'zh' instead of 'chi_sim'; missing chi_sim/chi_tra packs for Chinese.","solutions":["Install the missing language pack (Debian/Ubuntu: apt install tesseract-ocr-<code>; macOS: brew install tesseract-lang; Windows: download .traineddata from tessdata_fast)","Verify available languages with tesseract --list-langs","Fix the code: use 3-letter ISO 639-2 codes (deu not de, chi_sim not zh)"],"exampleFix":"# before\nocrmypdf -l deu in.pdf out.pdf  # missing\n# after (install first)\n# apt install tesseract-ocr-deu\nocrmypdf -l deu in.pdf out.pdf","handlingStrategy":"validation","validationCode":"import subprocess\navailable = set(subprocess.run(['tesseract','--list-langs'], capture_output=True, text=True).stdout.split()[1:])\nmissing = set(requested_langs) - available\nif missing: install_or_abort(missing)","typeGuard":null,"tryCatchPattern":"catch ocrmypdf.MissingDependencyError, print install command per code, fail fast","preventionTips":["Pre-flight check tesseract --list-langs in Dockerfiles and batch scripts","Use ISO 639-2 codes; keep a mapping table for user-facing language names"],"tags":["ocr","ocrmypdf","tesseract","language-data","missing-dependency"],"backgroundTag":"missing-language-pack","analyzedSha":"5074a0b0e109362422b768fd271ed84bf717c4ec","analyzedAt":"2026-08-27T11:57:38.523Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}