quarkusio/quarkus · error · IllegalArgumentException
Converting to ${toFormat} is not supported
Error message
Converting to ${toFormat} is not supported What it means
JavadocTransformer.transform dispatches Javadoc conversion by target format: ASCIIDOC and MARKDOWN are supported; anything else (null or an unknown JavadocFormat) hits the default branch and throws IllegalArgumentException.
Source
Thrown at core/processor/src/main/java/io/quarkus/annotation/processor/documentation/config/formatter/JavadocTransformer.java:17
package io.quarkus.annotation.processor.documentation.config.formatter;
import io.quarkus.annotation.processor.documentation.config.model.JavadocFormat;
public final class JavadocTransformer {
private JavadocTransformer() {
}
public static String transform(String javadoc, JavadocFormat fromFormat, JavadocFormat toFormat) {
switch (toFormat) {
case ASCIIDOC:
return JavadocToAsciidocTransformer.toAsciidoc(javadoc, fromFormat);
case MARKDOWN:
return JavadocToMarkdownTransformer.toMarkdown(javadoc, fromFormat);
default:
throw new IllegalArgumentException("Converting to " + toFormat + " is not supported");
}
}
}
View on GitHub (pinned to e1c734241f)
Solutions
- Pass JavadocFormat.ASCIIDOC or JavadocFormat.MARKDOWN as the target format
- Check for null/default format before calling transform
- Update JavadocTransformer's switch to handle any newly added format enum constant
- Audit the caller to see where the bad format value originates
Example fix
// before JavadocFormat toFormat = null; // unset String out = JavadocTransformer.transform(javadoc, from, toFormat); // after JavadocFormat toFormat = JavadocFormat.ASCIIDOC; String out = JavadocTransformer.transform(javadoc, from, toFormat);
Defensive patterns
Strategy: validation
Validate before calling
Objects.requireNonNull(toFormat, "toFormat must be set");
if (toFormat != JavadocFormat.ASCIIDOC && toFormat != JavadocFormat.MARKDOWN) {
throw new IllegalArgumentException("Unsupported target format: " + toFormat);
} Try / catch
try {
return JavadocTransformer.transform(javadoc, from, toFormat);
} catch (IllegalArgumentException e) {
if (e.getMessage() != null && e.getMessage().startsWith("Converting to")) {
return JavadocTransformer.transform(javadoc, from, JavadocFormat.ASCIIDOC);
}
throw e;
} Prevention
- Only pass ASCIIDOC or MARKDOWN as the target format
- Default unset format variables to a valid enum constant
- Update the transformer switch whenever JavadocFormat gains a new constant
When it happens
Trigger: Calling JavadocTransformer.transform(javadoc, fromFormat, toFormat) with toFormat that is neither ASCIIDOC nor MARKDOWN — typically a null format from an unset configuration or a newly added enum constant not yet handled in the switch.
Common situations: Custom doc tooling passing an uninitialized format variable; adding a new JavadocFormat constant to the enum without updating the transformer switch; configuration mistake in a documentation generation pipeline.
Related errors
- Conversion from Markdown to Asciidoc is not supported
- Unable to find javadoc for config item ${enclosingElement} $
- Unable to read the resolved model from: ${resolvedModelPath}
- Could not parse HTML entity &${abbrev}; in ${text}
- Unable to parse: ${javadocPath}
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/5e440144c2057ddf.
Report an issue: GitHub.