opendataloader-project/opendataloader-pdf · error · IllegalArgumentException

Option --%s: unsupported value '%s'. Supported values: %s, %

Error message

Option --%s: unsupported value '%s'. Supported values: %s, %s, %s

What it means

Thrown when --hybrid-hancom-ai-ocr-strategy receives a value that is not off, auto, or force. Constants come from HybridConfig: OCR_OFF (stream-only), OCR_AUTO (default; stream first, OCR fallback), OCR_FORCE (OCR-only). The option requires --hybrid=hancom-ai. Note this is distinct from the deprecated --hybrid-ocr flag, which only prints a warning and has no effect.

Source

Thrown at java/opendataloader-pdf-core/src/main/java/org/opendataloader/pdf/api/cli/CLIOptions.java:728

                String normalized = value.trim().toLowerCase(Locale.ROOT);
                if (!HybridConfig.REGIONLIST_TABLE_FIRST.equals(normalized)
                        && !HybridConfig.REGIONLIST_LIST_ONLY.equals(normalized)) {
                    throw new IllegalArgumentException(String.format(
                            "Option --%s: unsupported value '%s'. Supported values: %s, %s",
                            HYBRID_HANCOM_AI_REGIONLIST_STRATEGY_LONG_OPTION, normalized,
                            HybridConfig.REGIONLIST_TABLE_FIRST, HybridConfig.REGIONLIST_LIST_ONLY));
                }
                config.getHybridConfig().setRegionlistStrategy(normalized);
            }
        }
        if (commandLine.hasOption(HYBRID_HANCOM_AI_OCR_STRATEGY_LONG_OPTION)) {
            String value = commandLine.getOptionValue(HYBRID_HANCOM_AI_OCR_STRATEGY_LONG_OPTION);
            if (value != null && !value.trim().isEmpty()) {
                String normalized = value.trim().toLowerCase(Locale.ROOT);
                if (!HybridConfig.OCR_OFF.equals(normalized)
                        && !HybridConfig.OCR_AUTO.equals(normalized)
                        && !HybridConfig.OCR_FORCE.equals(normalized)) {
                    throw new IllegalArgumentException(String.format(
                            "Option --%s: unsupported value '%s'. Supported values: %s, %s, %s",
                            HYBRID_HANCOM_AI_OCR_STRATEGY_LONG_OPTION, normalized,
                            HybridConfig.OCR_OFF, HybridConfig.OCR_AUTO, HybridConfig.OCR_FORCE));
                }
                config.getHybridConfig().setOcrStrategy(normalized);
            }
        }
        if (commandLine.hasOption(HYBRID_HANCOM_AI_IMAGE_CACHE_LONG_OPTION)) {
            String value = commandLine.getOptionValue(HYBRID_HANCOM_AI_IMAGE_CACHE_LONG_OPTION);
            if (value != null && !value.trim().isEmpty()) {
                String normalized = value.trim().toLowerCase(Locale.ROOT);
                if (!"memory".equals(normalized) && !"disk".equals(normalized)) {
                    throw new IllegalArgumentException(String.format(
                            "Option --%s: unsupported value '%s'. Supported values: memory, disk",
                            HYBRID_HANCOM_AI_IMAGE_CACHE_LONG_OPTION, normalized));
                }
                config.getHybridConfig().setImageCache(normalized);
            }

View on GitHub (pinned to a7789b8e77)

Solutions

  1. Use `off`, `auto`, or `force`.
  2. Ensure `--hybrid=hancom-ai` is set.
  3. Omit the flag to keep the default (auto).

Example fix

// before
opendataloader-pdf doc.pdf --hybrid hancom-ai --hybrid-hancom-ai-ocr-strategy always
// after
opendataloader-pdf doc.pdf --hybrid hancom-ai --hybrid-hancom-ai-ocr-strategy force
Defensive patterns

Strategy: validation

Validate before calling

Set<String> OK = Set.of(HybridConfig.OCR_OFF, HybridConfig.OCR_AUTO, HybridConfig.OCR_FORCE);
String normalized = value.trim().toLowerCase(Locale.ROOT);
if (!OK.contains(normalized)) {
    throw new IllegalArgumentException("Bad ocr strategy: " + value);
}

Type guard

boolean isAcceptableOcrStrategy(String v) {
    String n = v.trim().toLowerCase(Locale.ROOT);
    return HybridConfig.OCR_OFF.equals(n) || HybridConfig.OCR_AUTO.equals(n) || HybridConfig.OCR_FORCE.equals(n);
}

Try / catch

try {
    CLIOptions.applyAllTo(config, cmd);
} catch (IllegalArgumentException e) {
    System.err.println(e.getMessage());
    System.exit(2);
}

Prevention

When it happens

Trigger: Pass `--hybrid-hancom-ai-ocr-strategy always`, `on`, or a typo like `forc`. Only the three exact tokens are accepted.

Common situations: Using synonyms (on/always) instead of the exact tokens; confusing this with the deprecated --hybrid-ocr; typos.

Related errors


AI-assisted analysis of opendataloader-project/opendataloader-pdf@a7789b8e77 (2026-08-14). Data as JSON: /api/errors/ca5a535be5bd2267. Report an issue: GitHub.