{"record":{"id":"20cb2576190d402a","repo":"ocrmypdf/OCRmyPDF","slug":"rotate-pages-is-required-for-rotate-pages-thre","errorCode":null,"errorMessage":"--rotate-pages is required for --rotate-pages-threshold","messagePattern":"--rotate-pages is required for --rotate-pages-threshold","errorType":"validation","errorClass":"BadArgsError","httpStatus":null,"severity":"error","filePath":"src/ocrmypdf/_validation.py","lineNumber":121,"sourceCode":"                \"--sidecar filename needed when output file is not a path.\"\n            )\n        options.sidecar = os.fspath(options.output_file) + '.txt'\n    if options.sidecar == options.input_file or options.sidecar == options.output_file:\n        raise BadArgsError(\n            \"--sidecar file must be different from the input and output files\"\n        )\n\n\ndef check_options_preprocessing(options: OcrOptions) -> None:\n    if options.clean_final:\n        options.clean = True\n    if options.unpaper_args and not options.clean:\n        raise BadArgsError(\"--clean is required for --unpaper-args\")\n    if (\n        options.rotate_pages_threshold != DEFAULT_ROTATE_PAGES_THRESHOLD\n        and not options.rotate_pages\n    ):\n        raise BadArgsError(\"--rotate-pages is required for --rotate-pages-threshold\")\n    if options.clean:\n        check_external_program(\n            program='unpaper',\n            package='unpaper',\n            version_checker=unpaper.version,\n            need_version='6.1',\n            required_for=\"--clean, --clean-final\",\n        )\n\n\ndef check_options_strip(options: OcrOptions) -> None:\n    \"\"\"Reject options that cannot apply in strip mode.\n\n    ``--mode strip`` removes the OCR text layer in place without rasterizing or\n    running OCR, so image-processing and OCR-output options have no effect.\n    \"\"\"\n    if options.mode != ProcessingMode.strip_text:\n        return","sourceCodeStart":103,"sourceCodeEnd":139,"githubUrl":"https://github.com/ocrmypdf/OCRmyPDF/blob/5074a0b0e109362422b768fd271ed84bf717c4ec/src/ocrmypdf/_validation.py#L103-L139","documentation":"Raised when --rotate-pages-threshold is customized without enabling --rotate-pages. The threshold only tunes the rotation feature, which must be turned on first.","triggerScenarios":"options.rotate_pages_threshold != DEFAULT_ROTATE_PAGES_THRESHOLD while options.rotate_pages is false; checked in check_options_preprocessing.","commonSituations":"Users tuning detection sensitivity without realizing the base flag is required.","solutions":["Add --rotate-pages to the command","Remove --rotate-pages-threshold if automatic rotation is not desired"],"exampleFix":"# before\nocrmypdf --rotate-pages-threshold 0.6 in.pdf out.pdf\n# after\nocrmypdf --rotate-pages --rotate-pages-threshold 0.6 in.pdf out.pdf","handlingStrategy":"validation","validationCode":"if rotate_pages_threshold != default and not rotate_pages:\n    rotate_pages = True  # or strip threshold","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Group dependent flags in config templates so tuning flags always ship with their enabler"],"tags":["ocr","ocrmypdf","rotation","cli-arguments"],"backgroundTag":"dependent-option-missing","analyzedSha":"5074a0b0e109362422b768fd271ed84bf717c4ec","analyzedAt":"2026-08-27T11:57:38.523Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}