opendataloader-project/opendataloader-pdf · error · IllegalArgumentException

Unsupported value '%s'. Supported values: all, hidden-text,

Error message

Unsupported value '%s'. Supported values: all, hidden-text, off-page, tiny, hidden-ocg

What it means

Thrown by the switch inside applyContentSafetyOption when a parsed value matches none of the recognized cases. The switch handles hidden-text, off-page, tiny, hidden-ocg, all, and a deprecated sensitive-data case (which now only prints a warning). Any other value hits the default branch and is rejected with the offending token echoed.

Source

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

                case "tiny":
                    config.getFilterConfig().setFilterTinyText(false);
                    break;
                case "hidden-ocg":
                    config.getFilterConfig().setFilterHiddenOCG(false);
                    break;
                case "sensitive-data":
                    System.err.println("Warning: '--content-safety-off sensitive-data' is deprecated and has no effect. "
                            + "Sensitive data sanitization is now opt-in. "
                            + "Use '--sanitize' to enable masking.");
                    break;
                case "all":
                    config.getFilterConfig().setFilterHiddenText(false);
                    config.getFilterConfig().setFilterOutOfPage(false);
                    config.getFilterConfig().setFilterTinyText(false);
                    config.getFilterConfig().setFilterHiddenOCG(false);
                    break;
                default:
                    throw new IllegalArgumentException(String.format(
                            "Unsupported value '%s'. Supported values: all, hidden-text, off-page, tiny, hidden-ocg",
                            value));
            }
        }
    }

    private static void applySanitizeOption(Config config, CommandLine commandLine) {
        if (commandLine.hasOption(SANITIZE_LONG_OPTION)) {
            config.getFilterConfig().setFilterSensitiveData(true);
        }
    }

    private static void applyFormatOption(Config config, CommandLine commandLine) {
        if (!commandLine.hasOption(FORMAT_OPTION)) {
            return;
        }

        String[] optionValues = commandLine.getOptionValues(FORMAT_OPTION);

View on GitHub (pinned to a7789b8e77)

Solutions

  1. Use one of: all, hidden-text, off-page, tiny, hidden-ocg.
  2. Mind the hyphens: hidden-text, off-page, hidden-ocg are the exact tokens.
  3. Use `all` to disable every safety filter at once.

Example fix

// before
opendataloader-pdf doc.pdf --content-safety-off hiden-text
// after
opendataloader-pdf doc.pdf --content-safety-off hidden-text
Defensive patterns

Strategy: validation

Validate before calling

Set<String> ALLOWED = Set.of("all", "hidden-text", "off-page", "tiny", "hidden-ocg");
for (String value : parseOptionValues(commandLine.getOptionValues("content-safety-off"))) {
    if (!ALLOWED.contains(value)) throw new IllegalArgumentException("Bad --content-safety-off token: " + value);
}

Type guard

boolean isAcceptableContentSafetyToken(String v) {
    return Set.of("all", "hidden-text", "off-page", "tiny", "hidden-ocg").contains(v);
}

Try / catch

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

Prevention

When it happens

Trigger: Pass `--content-safety-off everything`, a typo like `hiden-text`, an outdated name like `--content-safety-off sensitive-data` is NOT an error (deprecated, warns only), but `--content-safety-off hiddenocg` (missing hyphen) or `--content-safety-off tiny-text` is.

Common situations: Typos or missing hyphens; assuming a value from documentation of a different version; combining words; using the old sensitive-data token actually succeeds (warning only) so users misremember which tokens are valid.

Related errors


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