ocrmypdf/OCRmyPDF · error · MissingDependencyError

Ghostscript {gs_version} contains serious regressions and is

Error message

Ghostscript {gs_version} contains serious regressions and is not supported. Please upgrade to a newer version.

What it means

The Ghostscript plugin's check_options() runs a version blacklist before processing. Ghostscript releases listed in BLACKLISTED_GS_VERSIONS are known-broken enough that ocrmypdf refuses to use them at all, regardless of options.

Source

Thrown at src/ocrmypdf/builtin_plugins/ghostscript.py:196

    # Use the model's CLI generation method
    GhostscriptOptions.add_arguments_to_parser(parser)


@hookimpl
def check_options(options):
    """Check that the options are valid for this plugin."""
    # Only require Ghostscript for pdfa* output types (not 'auto' or 'pdf')
    # 'auto' mode uses best-effort PDF/A without Ghostscript fallback
    if options.output_type.startswith('pdfa'):
        check_external_program(
            program='gs',
            package='ghostscript',
            version_checker=ghostscript.version,
            need_version='9.54',  # RHEL 9's version; Ubuntu 22.04 has 9.55
        )
        gs_version = ghostscript.version()
        if gs_version in BLACKLISTED_GS_VERSIONS:
            raise MissingDependencyError(
                f"Ghostscript {gs_version} contains serious regressions and is not "
                "supported. Please upgrade to a newer version."
            )
        if Version('10.0.0') <= gs_version < Version('10.02.1') and (
            options.mode in (ProcessingMode.skip, ProcessingMode.redo)
        ):
            raise MissingDependencyError(
                f"Ghostscript 10.0.0 through 10.02.0 (your version: {gs_version}) "
                "contain serious regressions that corrupt PDFs with existing text, "
                "such as those processed using --skip-text or --redo-ocr "
                "(or --mode skip/redo). Please upgrade to a newer version, or use "
                "--output-type pdf to avoid Ghostscript, or use --force-ocr "
                "(or --mode force) to discard existing text."
            )
        if ghostscript.jpeg_truncation_bug(gs_version):
            log.warning(
                "Ghostscript %s contains JPEG encoding errors that may corrupt "
                "images. OCRmyPDF will attempt to mitigate, but this version is "

View on GitHub (pinned to 5074a0b0e1)

Solutions

  1. Upgrade Ghostscript to a non-blacklisted release (e.g. current 10.x) via your package manager.
  2. In containers/CI, install an up-to-date Ghostscript in the image instead of relying on the base distro version.
Defensive patterns

Strategy: validation

Validate before calling

from ocrmypdf.builtin_plugins.ghostscript import BLACKLISTED_GS_VERSIONS
from ocrmypdf.builtin_plugins import ghostscript
v = ghostscript.version()
assert v not in BLACKLISTED_GS_VERSIONS, f'blacklisted Ghostscript {v}'

Prevention

When it happens

Trigger: Invoking ocr() (or any pipeline run) on a machine whose `gs --version` reports one of the blacklisted releases.

Common situations: Distro packages or CI images pinning a defective Ghostscript build; upgrading the OS and inheriting a bad version.

Related errors


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