{"record":{"id":"9243705323769842","repo":"ocrmypdf/OCRmyPDF","slug":"since-you-specified-output-type-none-the-outp","errorCode":null,"errorMessage":"Since you specified `--output-type none`, the output file {str(self.output_file)} cannot be produced. Set the output file to `-` to suppress this message.","messagePattern":"Since you specified `--output-type none`, the output file (.+?) cannot be produced\\. Set the output file to `-` to suppress this message\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/ocrmypdf/_options.py","lineNumber":471,"sourceCode":"                \"--redo-ocr (or --mode redo) is not currently compatible with \"\n                \"--deskew, --clean-final, and --remove-background\"\n            )\n        return self\n\n    @model_validator(mode='after')\n    def validate_output_type_compatibility(self):\n        \"\"\"Validate output type is compatible with output file.\"\"\"\n        if self.output_type == 'none' and str(self.output_file) not in (\n            os.devnull,\n            '-',\n        ):\n            raise ValueError(\n                \"Since you specified `--output-type none`, the output file \"\n                f\"{str(self.output_file)} cannot be produced. Set the output file to \"\n                f\"`-` to suppress this message.\"\n            )\n        return self\n\n    @property\n    def lossless_reconstruction(self):\n        \"\"\"Determine lossless_reconstruction based on other options.\"\"\"\n        lossless = not any(\n            [\n                self.deskew,\n                self.clean_final,\n                self.mode == ProcessingMode.force,\n                self.remove_background,\n            ]\n        )\n        return lossless\n\n    def model_dump_json_safe(self) -> str:\n        \"\"\"Serialize to JSON with special handling for non-serializable types.\"\"\"\n        # Create a copy of the model data for serialization\n        data = self.model_dump()\n","sourceCodeStart":453,"sourceCodeEnd":489,"githubUrl":"https://github.com/ocrmypdf/OCRmyPDF/blob/5074a0b0e109362422b768fd271ed84bf717c4ec/src/ocrmypdf/_options.py#L453-L489","documentation":"Raised when --output-type none is used but the output file is not '-' or os.devnull. Output type 'none' produces no output file, so naming a real output path is contradictory.","triggerScenarios":"Setting output_type='none' in OcrOptions while output_file is a real path or stream other than '-' / os.devnull; validated in OcrOptions validation during create_options/execute_ocrmypdf.","commonSituations":"Using --output-type none for sidecar-only or verification runs while still naming an output PDF; API users passing a file object.","solutions":["Set output_file to '-' (or os.devnull) when output_type='none'","Remove --output-type none if you actually want a PDF written"],"exampleFix":"# before\nocrmypdf --output-type none -l eng in.pdf out.pdf --sidecar out.txt\n# after\nocrmypdf --output-type none -l eng in.pdf - --sidecar out.txt","handlingStrategy":"validation","validationCode":"import os\nif opts.output_type == 'none' and str(opts.output_file) not in (os.devnull, '-'):\n    opts.output_file = '-'","typeGuard":null,"tryCatchPattern":"catch ValueError and re-ask user for output destination","preventionTips":["Treat output_type='none' as sidecar/verification-only runs targeting '-'"],"tags":["ocr","ocrmypdf","output-configuration","validation"],"backgroundTag":"invalid-option-combination","analyzedSha":"5074a0b0e109362422b768fd271ed84bf717c4ec","analyzedAt":"2026-08-27T11:57:38.523Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}