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

What it means

Thrown when --hybrid-hancom-ai-regionlist-strategy receives a value that is neither table-first nor list-only. These constants come from HybridConfig (REGIONLIST_TABLE_FIRST, REGIONLIST_LIST_ONLY) and control how DLA label 7 (regionlist) pages are handled: table-first checks table-structure-recognition overlap (default), list-only skips TSR and always treats the region as a list. The option requires --hybrid=hancom-ai.

Source

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

                try {
                    int timeout = Integer.parseInt(timeoutValue.trim());
                    config.getHybridConfig().setTimeoutMs(timeout);
                } catch (NumberFormatException e) {
                    throw new IllegalArgumentException(
                            String.format("Invalid timeout value '%s'. Must be a non-negative integer.", timeoutValue));
                }
            }
        }
        if (commandLine.hasOption(HYBRID_FALLBACK_LONG_OPTION)) {
            config.getHybridConfig().setFallbackToJava(true);
        }
        if (commandLine.hasOption(HYBRID_HANCOM_AI_REGIONLIST_STRATEGY_LONG_OPTION)) {
            String value = commandLine.getOptionValue(HYBRID_HANCOM_AI_REGIONLIST_STRATEGY_LONG_OPTION);
            if (value != null && !value.trim().isEmpty()) {
                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));

View on GitHub (pinned to a7789b8e77)

Solutions

  1. Use `table-first` or `list-only`.
  2. Ensure `--hybrid=hancom-ai` is also set.
  3. Omit the flag to keep the default (table-first).

Example fix

// before
opendataloader-pdf doc.pdf --hybrid hancom-ai --hybrid-hancom-ai-regionlist-strategy tablefirst
// after
opendataloader-pdf doc.pdf --hybrid hancom-ai --hybrid-hancom-ai-regionlist-strategy table-first
Defensive patterns

Strategy: validation

Validate before calling

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

Type guard

boolean isAcceptableRegionlistStrategy(String v) {
    String n = v.trim().toLowerCase(Locale.ROOT);
    return HybridConfig.REGIONLIST_TABLE_FIRST.equals(n) || HybridConfig.REGIONLIST_LIST_ONLY.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-regionlist-strategy both`, `--hybrid-hancom-ai-regionlist-strategy tablefirst` (missing hyphen), or any value besides the two constants. Using this option without --hybrid=hancom-ai is a logic error (silently ignored) even if the value is valid.

Common situations: Dropping the hyphen in table-first; guessing a third strategy; setting the strategy while running a non-hancom-ai backend.

Related errors


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