OpenAPITools/openapi-generator · error · IllegalArgumentException
Currently, reactive option doesn't supported by Spring Cloud
Error message
Currently, reactive option doesn't supported by Spring Cloud
What it means
In the spring generator, the reactive option (reactive=true, which enables WebFlux/Reactor return types) is explicitly incompatible with the spring-cloud library (spring-cloud-openfeign based). processOpts() throws IllegalArgumentException as soon as both are set, because the spring-cloud templates have no reactive variants.
Source
Thrown at modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java:569
// does not support auto-generated markdown doc at the moment
// TODO: add doc templates
modelDocTemplateFiles.remove("model_doc.mustache");
apiDocTemplateFiles.remove("api_doc.mustache");
convertPropertyToStringAndWriteBack(TITLE, this::setTitle);
convertPropertyToStringAndWriteBack(CONFIG_PACKAGE, this::setConfigPackage);
convertPropertyToStringAndWriteBack(BASE_PACKAGE, this::setBasePackage);
convertPropertyToBooleanAndWriteBack(VIRTUAL_SERVICE, this::setVirtualService);
convertPropertyToBooleanAndWriteBack(INTERFACE_ONLY, this::setInterfaceOnly);
convertPropertyToBooleanAndWriteBack(USE_FEIGN_CLIENT_URL, this::setUseFeignClientUrl);
convertPropertyToBooleanAndWriteBack(USE_FEIGN_CLIENT_CONTEXT_ID, this::setUseFeignClientContextId);
convertPropertyToBooleanAndWriteBack(DELEGATE_PATTERN, this::setDelegatePattern);
convertPropertyToBooleanAndWriteBack(SINGLE_CONTENT_TYPES, this::setSingleContentTypes);
convertPropertyToBooleanAndWriteBack(SKIP_DEFAULT_INTERFACE, this::setSkipDefaultInterface);
convertPropertyToBooleanAndWriteBack(ASYNC, this::setAsync);
if (additionalProperties.containsKey(REACTIVE)) {
if (SPRING_CLOUD_LIBRARY.equals(library)) {
throw new IllegalArgumentException("Currently, reactive option doesn't supported by Spring Cloud");
}
convertPropertyToBooleanAndWriteBack(REACTIVE, this::setReactive);
convertPropertyToBooleanAndWriteBack(SSE, this::setSse);
}
if (additionalProperties.containsKey(INCLUDE_HTTP_REQUEST_CONTEXT)) {
convertPropertyToBooleanAndWriteBack(INCLUDE_HTTP_REQUEST_CONTEXT, this::setIncludeHttpRequestContext);
}
//set default value for includeHttpRequestContext based on reactive/blocking
if (includeHttpRequestContext == null) {
if (this.reactive) {
//default to true for reactive
this.setIncludeHttpRequestContext(this.isDefaultIncludeHttpRequestContextForReactive());
LOGGER.info("Defaulting {} to '{}' for reactive", INCLUDE_HTTP_REQUEST_CONTEXT, this.isDefaultIncludeHttpRequestContextForReactive());
} else {
//default to false for blocking
this.setIncludeHttpRequestContext(this.isDefaultIncludeHttpRequestContextForBlocking());
LOGGER.info("Defaulting {} to '{}' for blocking", INCLUDE_HTTP_REQUEST_CONTEXT, this.isDefaultIncludeHttpRequestContextForBlocking());
}View on GitHub (pinned to fcec517be3)
Solutions
- Remove reactive=true (or set reactive=false) for spring-cloud generation
- Or switch the library to spring-boot to keep reactive/WebFlux output
- Split shared configs so reactive is opt-in per library instead of global
- If you need reactive Feign, generate with spring-cloud without reactive and adapt manually
Example fix
# before openapi-generator-cli generate -i api.yaml -g spring -l spring-cloud -c reactive=true # after (option A: drop reactive) openapi-generator-cli generate -i api.yaml -g spring -l spring-cloud # after (option B: keep reactive, switch library) openapi-generator-cli generate -i api.yaml -g spring -l spring-boot -c reactive=true
Defensive patterns
Strategy: validation
Validate before calling
# bash: enforce the option-compatibility matrix up front
if [[ "${LIBRARY:-spring-boot}" == spring-cloud && "${REACTIVE:-false}" == true ]]; then
echo 'reactive=true is not supported with -l spring-cloud'; exit 1
fi Try / catch
try {
SpringCodegen codegen = new SpringCodegen();
codegen.setLibrary("spring-boot"); // not spring-cloud when reactive
codegen.setReactive(true);
new DefaultGenerator().opts(new ClientOptInput().opts(codegen)).generate();
} catch (IllegalArgumentException e) {
// 'Currently, reactive option doesn't supported by Spring Cloud' - drop reactive or switch library
} Prevention
- Keep reactive opt-in per job instead of a global default in shared configs
- Document which spring libraries are reactive-capable (spring-boot) vs Feign-based (spring-cloud)
- Encode the library x reactive matrix in your generation wrapper so invalid combos fail before the generator runs
When it happens
Trigger: openapi-generator-cli generate -i api.yaml -g spring -l spring-cloud -c reactive=true; or a Maven/Gradle plugin config with <library>spring-cloud</library> and <reactive>true</reactive>. Also hit when reactive=true is set globally (e.g. in a shared config file) while one job selects -l spring-cloud.
Common situations: Organizations with a base config setting reactive=true for all spring services, then adding a Feign/spring-cloud client; upgrading pipelines where reactive was enabled for WebFlux services and later reused unintentionally.
Related errors
- clientRegistrationId is only supported with the spring-http-
- useJackson3 is only supported for the 'native', 'apache-http
- Invalid microprofileFramework '{microprofileFramework}'. Mus
- Version %s of MicroProfile Rest Client is not supported or i
- Unexpected serializationLibrary value: {serializationLibrary
AI-assisted analysis of OpenAPITools/openapi-generator@fcec517be3 (2026-08-22).
Data as JSON: /api/errors/5a25acbcc21d421f.
Report an issue: GitHub.