opendataloader-project/opendataloader-pdf · error · IllegalArgumentException

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

Error message

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

What it means

Thrown when --hybrid-hancom-ai-image-cache receives a value that is neither memory nor disk. Unlike most other hybrid options, these two literals are hardcoded inline (not exposed as HybridConfig constants), so the message is static rather than generated from a set. The option selects the page-image cache backing for the hancom-ai backend and requires --hybrid=hancom-ai. Default is memory.

Source

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

            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);
            }
        }
        if (commandLine.hasOption(HYBRID_HANCOM_AI_SAVE_CROPS_LONG_OPTION)) {
            config.getHybridConfig().setSaveCrops(true);
        }
        if (commandLine.hasOption(HYBRID_HANCOM_AI_CROP_OUTPUT_DIR_LONG_OPTION)) {
            String value = commandLine.getOptionValue(HYBRID_HANCOM_AI_CROP_OUTPUT_DIR_LONG_OPTION);
            if (value != null && !value.trim().isEmpty()) {
                config.getHybridConfig().setCropOutputDir(value.trim());
            }
        }
        if (commandLine.hasOption(TO_STDOUT_LONG_OPTION)) {
            config.setOutputStdout(true);
        }

View on GitHub (pinned to a7789b8e77)

Solutions

  1. Use `memory` or `disk`.
  2. Ensure `--hybrid=hancom-ai` is set.
  3. Omit the flag to keep the default (memory).

Example fix

// before
opendataloader-pdf doc.pdf --hybrid hancom-ai --hybrid-hancom-ai-image-cache mem
// after
opendataloader-pdf doc.pdf --hybrid hancom-ai --hybrid-hancom-ai-image-cache memory
Defensive patterns

Strategy: validation

Validate before calling

String n = value.trim().toLowerCase(Locale.ROOT);
if (!"memory".equals(n) && !"disk".equals(n)) {
    throw new IllegalArgumentException("Bad image-cache value: " + value);
}

Type guard

boolean isAcceptableImageCache(String v) {
    String n = v.trim().toLowerCase(Locale.ROOT);
    return "memory".equals(n) || "disk".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-image-cache mem`, `--hybrid-hancom-ai-image-cache ram`, `--hybrid-hancom-ai-image-cache ssd`, or `--hybrid-hancom-ai-image-cache DISK` (lowercased first, so case is fine, but the synonym must be exact).

Common situations: Using abbreviations (mem/ram) instead of the full token; guessing storage tiers (ssd); assuming the constants are exposed elsewhere.

Related errors


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