{"record":{"id":"4be2c947e42e0582","repo":"ocrmypdf/OCRmyPDF","slug":"ghostscript-10-0-0-through-10-02-0-your-version","errorCode":null,"errorMessage":"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.","messagePattern":"Ghostscript 10\\.0\\.0 through 10\\.02\\.0 \\(your 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\\.","errorType":"validation","errorClass":"MissingDependencyError","httpStatus":null,"severity":"error","filePath":"src/ocrmypdf/builtin_plugins/ghostscript.py","lineNumber":203,"sourceCode":"    # Only require Ghostscript for pdfa* output types (not 'auto' or 'pdf')\n    # 'auto' mode uses best-effort PDF/A without Ghostscript fallback\n    if options.output_type.startswith('pdfa'):\n        check_external_program(\n            program='gs',\n            package='ghostscript',\n            version_checker=ghostscript.version,\n            need_version='9.54',  # RHEL 9's version; Ubuntu 22.04 has 9.55\n        )\n        gs_version = ghostscript.version()\n        if gs_version in BLACKLISTED_GS_VERSIONS:\n            raise MissingDependencyError(\n                f\"Ghostscript {gs_version} contains serious regressions and is not \"\n                \"supported. Please upgrade to a newer version.\"\n            )\n        if Version('10.0.0') <= gs_version < Version('10.02.1') and (\n            options.mode in (ProcessingMode.skip, ProcessingMode.redo)\n        ):\n            raise MissingDependencyError(\n                f\"Ghostscript 10.0.0 through 10.02.0 (your version: {gs_version}) \"\n                \"contain serious regressions that corrupt PDFs with existing text, \"\n                \"such as those processed using --skip-text or --redo-ocr \"\n                \"(or --mode skip/redo). Please upgrade to a newer version, or use \"\n                \"--output-type pdf to avoid Ghostscript, or use --force-ocr \"\n                \"(or --mode force) to discard existing text.\"\n            )\n        if ghostscript.jpeg_truncation_bug(gs_version):\n            log.warning(\n                \"Ghostscript %s contains JPEG encoding errors that may corrupt \"\n                \"images. OCRmyPDF will attempt to mitigate, but this version is \"\n                \"strongly not recommended. Please upgrade to Ghostscript %s or \"\n                \"later, which fixes this.\",\n                gs_version,\n                ghostscript.GS_JPEG_TRUNCATION_FIXED,\n            )\n        if options.output_type == 'pdfa':\n            options.output_type = 'pdfa-2'","sourceCodeStart":185,"sourceCodeEnd":221,"githubUrl":"https://github.com/ocrmypdf/OCRmyPDF/blob/5074a0b0e109362422b768fd271ed84bf717c4ec/src/ocrmypdf/builtin_plugins/ghostscript.py#L185-L221","documentation":"Ghostscript 10.0.0–10.02.0 corrupt PDFs that already contain text when it reprocesses them. If your options use ProcessingMode.skip or redo with those versions, check_options() aborts with MissingDependencyError before damage can occur.","triggerScenarios":"Running with --skip-text/--redo-ocr (or mode=skip/redo) and Ghostscript >=10.0.0 and <10.02.1 while producing a PDF/A (default output type).","commonSituations":"New distro ships Ghostscript 10.0/10.1; default output type is pdfa which routes through Ghostscript, colliding with skip/redo mode.","solutions":["Upgrade Ghostscript to 10.02.1 or newer.","Use --output-type pdf to bypass Ghostscript entirely.","Switch to --force-ocr (mode=force) so existing text is discarded and the regression does not apply."],"exampleFix":"# before\nocr(in.pdf, out.pdf, skip_text=True)\n# after (one of)\nocr(in.pdf, out.pdf, skip_text=True, output_type='pdf')\nocr(in.pdf, out.pdf, force_ocr=True)","handlingStrategy":"validation","validationCode":"from packaging.version import Version\nfrom ocrmypdf.builtin_plugins import ghostscript\nv = ghostscript.version()\nif Version('10.0.0') <= v < Version('10.02.1'):\n    assert options_mode not in ('skip', 'redo') or output_type == 'pdf', \\\n        'GS 10.0-10.02.0 corrupts skip/redo output unless --output-type pdf'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Upgrade Ghostscript to >=10.02.1 in base images.","When stuck on 10.0-10.02.0, pair skip/redo with --output-type pdf."],"tags":["ocrmypdf","ghostscript","skip-text","redo-ocr","version-conflict"],"backgroundTag":"unsupported-dependency-version","analyzedSha":"5074a0b0e109362422b768fd271ed84bf717c4ec","analyzedAt":"2026-08-27T11:57:38.523Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}