{"record":{"id":"c731791fc4e377bb","repo":"opendataloader-project/opendataloader-pdf","slug":"unsupported-image-format-s-supported-values-p","errorCode":null,"errorMessage":"Unsupported image format '%s'. Supported values: png, jpeg","messagePattern":"Unsupported image format '(.+?)'\\. Supported values: png, jpeg","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"java/opendataloader-pdf-core/src/main/java/org/opendataloader/pdf/api/cli/CLIOptions.java","lineNumber":472,"sourceCode":"                                Config.getImageOutputOptions(\", \")));\n            }\n            String output = outputValue.trim().toLowerCase(Locale.ROOT);\n            if (!Config.isValidImageOutput(output)) {\n                throw new IllegalArgumentException(\n                        String.format(\"Unsupported image output mode '%s'. Supported values: %s\",\n                                output, Config.getImageOutputOptions(\", \")));\n            }\n            config.setImageOutput(output);\n        }\n        if (commandLine.hasOption(IMAGE_FORMAT_LONG_OPTION)) {\n            String formatValue = commandLine.getOptionValue(IMAGE_FORMAT_LONG_OPTION);\n            if (formatValue == null || formatValue.trim().isEmpty()) {\n                throw new IllegalArgumentException(\n                        \"Option --image-format requires a value. Supported values: png, jpeg\");\n            }\n            String format = formatValue.trim().toLowerCase(Locale.ROOT);\n            if (!Config.isValidImageFormat(format)) {\n                throw new IllegalArgumentException(\n                        String.format(\"Unsupported image format '%s'. Supported values: png, jpeg\", format));\n            }\n            config.setImageFormat(format);\n        }\n        if (commandLine.hasOption(IMAGE_DIR_LONG_OPTION)) {\n            config.setImageDir(commandLine.getOptionValue(IMAGE_DIR_LONG_OPTION));\n        }\n        if (commandLine.hasOption(IMAGE_RESOLUTION_LONG_OPTION)) {\n            try {\n                double imageResolution = Double.parseDouble(commandLine.getOptionValue(IMAGE_RESOLUTION_LONG_OPTION));\n                if (!Double.isFinite(imageResolution) || imageResolution <= 0) {\n                    throw new IllegalArgumentException(\n                        \"Option --image-resolution requires a finite positive double value.\");\n                }\n                config.setImageResolution(imageResolution);\n            } catch (NumberFormatException e) {\n                throw new IllegalArgumentException(\n                    \"Option --image-resolution requires valid double value.\", e);","sourceCodeStart":454,"sourceCodeEnd":490,"githubUrl":"https://github.com/opendataloader-project/opendataloader-pdf/blob/a7789b8e77dd05e2b8659eb3ea12fc458f80bfb8/java/opendataloader-pdf-core/src/main/java/org/opendataloader/pdf/api/cli/CLIOptions.java#L454-L490","documentation":"Thrown when --image-format receives a non-empty value that is not one of the accepted formats. The value is trimmed and lowercased, then checked against the imageFormatOptions set (png, jpeg) via Config.isValidImageFormat; any other string is rejected with the offending value echoed back. This is a value-domain error, distinct from the empty-value error which fires earlier in the same block.","triggerScenarios":"Pass a synonym or extension like `--image-format jpg`, `--image-format tiff`, `--image-format webp`, or a typo like `--image-format pnng`. Note `jpg` is NOT accepted even though it is a common synonym — only `jpeg` is.","commonSituations":"Developers assume jpg is valid (it is not); migrating from a tool that accepted other formats; case or locale assumptions (the lowercasing is safe, so case is not the issue).","solutions":["Use exactly `png` or `jpeg`.","Replace `jpg` with `jpeg`.","Omit --image-format to keep the png default."],"exampleFix":"// before\nopendataloader-pdf doc.pdf --image-format jpg\n// after\nopendataloader-pdf doc.pdf --image-format jpeg","handlingStrategy":"type-guard","validationCode":"String f = userValue.trim().toLowerCase(Locale.ROOT);\nif (!Config.isValidImageFormat(f)) {\n    throw new IllegalArgumentException(\n        \"Unsupported image format '\" + userValue + \"'. Use: \" + Config.getImageFormatOptions(\", \"));\n}","typeGuard":"boolean isAcceptableImageFormat(String v) {\n    return v != null && Config.isValidImageFormat(v.trim().toLowerCase(Locale.ROOT));\n}","tryCatchPattern":"try {\n    config.setImageFormat(f);\n} catch (IllegalArgumentException e) {\n    // fall back to default png only if intentional; otherwise surface to user\n    config.setImageFormat(Config.IMAGE_FORMAT_PNG);\n}","preventionTips":["Remember jpg is NOT valid — only jpeg.","Always lowercase via Locale.ROOT before the isValid check to match the library.","Drive help text from Config.getImageFormatOptions so docs never drift from code."],"tags":["cli","image-format","validation","enum-value"],"backgroundTag":null,"analyzedSha":"a7789b8e77dd05e2b8659eb3ea12fc458f80bfb8","analyzedAt":"2026-08-14T05:22:03.953Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}