opendataloader-project/opendataloader-pdf · error · IllegalArgumentException
Unsupported format '%s'. Supported values: json, text, html,
Error message
Unsupported format '%s'. Supported values: json, text, html, pdf, markdown, tagged-pdf
What it means
Thrown by the default branch of the format switch when a parsed value matches no case. Recognized cases are json, text, html, pdf, markdown, tagged-pdf, plus deprecated markdown-with-html and markdown-with-images (accepted with a warning). Any other token is rejected with the offending value and the canonical supported list (which omits the deprecated names).
Source
Thrown at java/opendataloader-pdf-core/src/main/java/org/opendataloader/pdf/api/cli/CLIOptions.java:626
case "markdown":
config.setGenerateMarkdown(true);
break;
case "markdown-with-html":
System.err.println("[WARN] --format markdown-with-html is deprecated and will be removed "
+ "in the next major release. Use --format markdown --markdown-with-html instead.");
config.setUseHTMLInMarkdown(true);
break;
case "markdown-with-images":
System.err.println("[WARN] --format markdown-with-images is deprecated and will be removed "
+ "in the next major release. Use --format markdown with --image-output "
+ "(off|embedded|external) instead.");
config.setGenerateMarkdown(true);
break;
case "tagged-pdf":
config.setGenerateTaggedPDF(true);
break;
default:
throw new IllegalArgumentException(String.format(
"Unsupported format '%s'. Supported values: json, text, html, pdf, markdown, tagged-pdf",
value));
}
}
}
private static Set<String> parseOptionValues(String[] optionValues) {
Set<String> values = new LinkedHashSet<>();
for (String rawValue : optionValues) {
if (rawValue == null) {
continue;
}
String[] splitValues = rawValue.split(",");
for (String candidate : splitValues) {
String format = candidate.trim().toLowerCase(Locale.ROOT);
if (!format.isEmpty()) {
values.add(format);
}View on GitHub (pinned to a7789b8e77)
Solutions
- Use the full lowercase token: json, text, html, pdf, markdown, or tagged-pdf.
- Replace md with markdown and txt with text.
- If you used markdown-with-html, prefer `--format markdown --markdown-with-html`.
Example fix
// before opendataloader-pdf doc.pdf --format md // after opendataloader-pdf doc.pdf --format markdown
Defensive patterns
Strategy: validation
Validate before calling
Set<String> ALLOWED = Set.of("json", "text", "html", "pdf", "markdown", "tagged-pdf");
// NOTE: --format is case-sensitive (no lowercasing in the switch)
for (String value : parseOptionValues(commandLine.getOptionValues("format"))) {
if (!ALLOWED.contains(value)) throw new IllegalArgumentException("Bad --format token: " + value);
} Type guard
boolean isAcceptableFormatToken(String v) {
return Set.of("json", "text", "html", "pdf", "markdown", "tagged-pdf").contains(v);
} Try / catch
try {
CLIOptions.applyAllTo(config, cmd);
} catch (IllegalArgumentException e) {
System.err.println(e.getMessage());
System.exit(2);
} Prevention
- Use full lowercase tokens; avoid md/txt/htm abbreviations.
- Remember --format is case-sensitive — do not uppercase.
- For HTML-in-markdown use `--format markdown` plus `--markdown-with-html`, not the deprecated format alias.
When it happens
Trigger: Pass `--format md` (markdown is the full token), `--format txt`, `--format JSON` (case is NOT normalized for format values — the switch is case-sensitive, unlike image-format/table-method), or a typo like `markdwon`.
Common situations: Using common abbreviations (md, txt, htm) that are not accepted; uppercase values (this option does not lowercase, so case matters); assuming a deprecated alias still works after removal.
Related errors
- Unsupported image format '%s'. Supported values: png, jpeg
- Unsupported table method '%s'. Supported values: %s
- Unsupported value '%s'. Supported values: all, hidden-text,
- Option --format requires at least one value. Supported value
- Unsupported hybrid backend '%s'. Supported values: %s
AI-assisted analysis of opendataloader-project/opendataloader-pdf@a7789b8e77 (2026-08-14).
Data as JSON: /api/errors/217dae5146151cc7.
Report an issue: GitHub.