ocrmypdf/OCRmyPDF · error · BadArgsError

The following languages are for Tesseract's internal use and

Error message

The following languages are for Tesseract's internal use and should not be issued explicitly: {', '.join(blocked)}\nRemove them from the -l/--language argument.

What it means

Raised when the -l/--language argument includes 'equ' (math equations) or 'osd' (orientation and script detection). These Tesseract models are internal helpers, not standalone recognition languages, so ocrmypdf blocks them explicitly.

Source

Thrown at src/ocrmypdf/_validation.py:59

def check_platform() -> None:
    if sys.maxsize <= 2**32:  # pragma: no cover
        log.warning(
            "You are running OCRmyPDF in a 32-bit (x86) Python interpreter. "
            "This is not supported. 32-bit does not have enough address space "
            "to process large files. "
            "Please use a 64-bit (x86-64) version of Python."
        )


def check_options_languages(
    options: OcrOptions, ocr_engine_languages: AbstractSet[str]
) -> None:
    # Check for blocked languages first, before checking if they're installed
    DENIED_LANGUAGES = {'equ', 'osd'}
    blocked = DENIED_LANGUAGES & set(options.languages)
    if blocked:
        raise BadArgsError(
            "The following languages are for Tesseract's internal use and "
            "should not be issued explicitly: "
            f"{', '.join(blocked)}\n"
            "Remove them from the -l/--language argument."
        )

    if not ocr_engine_languages:
        return

    missing_languages = set(options.languages) - set(ocr_engine_languages)
    if missing_languages:
        lang_text = '\n'.join(lang for lang in missing_languages)
        msg = (
            "OCR engine does not have language data for the following "
            "requested languages: \n"
            f"{lang_text}\n"
            "Please install the appropriate language data for your OCR engine.\n"
            "\n"

View on GitHub (pinned to 5074a0b0e1)

Solutions

  1. Remove 'equ' and 'osd' from the -l/--language argument
  2. For orientation, use --rotate-pages instead of the osd model
  3. For equations, rely on the main language model

Example fix

# before
ocrmypdf -l eng+osd in.pdf out.pdf
# after
ocrmypdf -l eng --rotate-pages in.pdf out.pdf
Defensive patterns

Strategy: validation

Validate before calling

DENIED = {'equ', 'osd'}
langs = [l for l in requested_langs if l not in DENIED]

Prevention

When it happens

Trigger: options.languages containing 'equ' or 'osd', e.g. ocrmypdf -l osd or -l eng+equ; checked before installed-language validation.

Common situations: Users listing all outputs of tesseract --list-langs as language options; tutorials that mention osd for orientation detection.

Related errors


AI-assisted analysis of ocrmypdf/OCRmyPDF@5074a0b0e1 (2026-08-27). Data as JSON: /api/errors/8854d6a7446b2175. Report an issue: GitHub.