{"record":{"id":"98153aed780c1e2a","repo":"ocrmypdf/OCRmyPDF","slug":"the-following-languages-are-for-tesseract-s-intern-98153a","errorCode":null,"errorMessage":"The following languages are for Tesseract's internal use and should not be issued explicitly: {', '.join(DENIED_LANGUAGES & set(languages))}\\nRemove them from the -l/--language argument.","messagePattern":"The following languages are for Tesseract's internal use and should not be issued explicitly: (.+?)\\\\nRemove them from the -l/--language argument\\.","errorType":"validation","errorClass":"BadArgsError","httpStatus":null,"severity":"error","filePath":"src/ocrmypdf/builtin_plugins/tesseract_ocr.py","lineNumber":286,"sourceCode":"    def validate_downsample_consistency(self):\n        \"\"\"Validate downsample options are consistent.\"\"\"\n        if self.downsample_above != 32767 and not self.downsample_large_images:\n            log.warning(\n                \"The --tesseract-downsample-above argument will have no effect unless \"\n                \"--tesseract-downsample-large-images is also given.\"\n            )\n        return self\n\n    def validate_with_context(self, languages: list[str]) -> None:\n        \"\"\"Validate options that require external context.\n\n        Args:\n            languages: List of languages being used for OCR\n        \"\"\"\n        # Validate languages are not internal Tesseract languages\n        DENIED_LANGUAGES = {'equ', 'osd'}\n        if DENIED_LANGUAGES & set(languages):\n            raise BadArgsError(\n                \"The following languages are for Tesseract's internal use \"\n                \"and should not be issued explicitly: \"\n                f\"{', '.join(DENIED_LANGUAGES & set(languages))}\\n\"\n                \"Remove them from the -l/--language argument.\"\n            )\n\n\n@hookimpl\ndef register_options():\n    \"\"\"Register Tesseract option model.\"\"\"\n    return {'tesseract': TesseractOptions}\n\n\n@hookimpl\ndef add_options(parser):\n    # Use the model's CLI generation method - it now handles all Tesseract options\n    TesseractOptions.add_arguments_to_parser(parser)\n","sourceCodeStart":268,"sourceCodeEnd":304,"githubUrl":"https://github.com/ocrmypdf/OCRmyPDF/blob/5074a0b0e109362422b768fd271ed84bf717c4ec/src/ocrmypdf/builtin_plugins/tesseract_ocr.py#L268-L304","documentation":"Tesseract language codes 'equ' (equations) and 'osd' (orientation/script detection) are not real OCR languages — Tesseract runs them internally for specific features. validate_with_context() raises BadArgsError if they appear in the requested language list.","triggerScenarios":"Passing language=['eng','osd'] or -l eng+equ to ocr()/the CLI.","commonSituations":"Users copying a language string from a Tesseract tutorial that includes osd; trying to 'force' orientation detection via -l.","solutions":["Remove equ/osd from the language argument; use only real traineddata languages (eng, deu, ...).","For orientation detection rely on ocrmypdf's rotate/deskew options, which invoke osd internally themselves."],"exampleFix":"# before\nocr(in, out, language='eng+osd')\n# after\nocr(in, out, language='eng')","handlingStrategy":"validation","validationCode":"DENIED = {'equ', 'osd'}\nlangs = languages if isinstance(languages, list) else languages.split('+')\nassert not (DENIED & set(langs)), 'equ/osd are internal Tesseract codes'","typeGuard":"def is_valid_language_list(langs: list[str]) -> bool:\n    return not ({'equ','osd'} & set(langs))","tryCatchPattern":null,"preventionTips":["Filter equ/osd from user-supplied language strings before calling ocr().","Rely on ocrmypdf's rotate/deskew options instead of passing osd."],"tags":["ocrmypdf","tesseract","language-codes","bad-args"],"backgroundTag":"invalid-language-code","analyzedSha":"5074a0b0e109362422b768fd271ed84bf717c4ec","analyzedAt":"2026-08-27T11:57:38.523Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}