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

The kotlin-spring generator's 'spring-cloud' library target generates OpenFeign-style clients for Spring Cloud, which have no reactive (WebFlux) variant in this generator. When the `reactive` additional property is present and library=spring-cloud, processOpts() throws an IllegalArgumentException immediately (KotlinSpringServerCodegen.java:710) — before reactive is even parsed as a boolean.

Source

Thrown at modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinSpringServerCodegen.java:710

        if (additionalProperties.containsKey(SERVICE_IMPLEMENTATION)) {
            this.setServiceImplementation(Boolean.parseBoolean(additionalProperties.get(SERVICE_IMPLEMENTATION).toString()));
        }
        writePropertyBack(SERVICE_IMPLEMENTATION, serviceImplementation);

        if (additionalProperties.containsKey(USE_BEANVALIDATION)) {
            this.setUseBeanValidation(convertPropertyToBoolean(USE_BEANVALIDATION));
        }
        writePropertyBack(USE_BEANVALIDATION, useBeanValidation);

        if (additionalProperties.containsKey(SKIP_DEFAULT_INTERFACE)) {
            this.setSkipDefaultInterface(convertPropertyToBoolean(SKIP_DEFAULT_INTERFACE));
        }
        writePropertyBack(SKIP_DEFAULT_INTERFACE, skipDefaultInterface);

        if (additionalProperties.containsKey(REACTIVE)) {
            if (SPRING_CLOUD_LIBRARY.equals(library)) {
                throw new IllegalArgumentException("Currently, reactive option doesn't supported by Spring Cloud");
            }
            if (library.equals(SPRING_BOOT)) {
                this.setReactive(convertPropertyToBoolean(REACTIVE));
                // spring webflux doesn't support @ControllerAdvice
                this.setExceptionHandler(false);

                if (additionalProperties.containsKey(USE_FLOW_FOR_ARRAY_RETURN_TYPE)) {
                    this.setUseFlowForArrayReturnType(convertPropertyToBoolean(USE_FLOW_FOR_ARRAY_RETURN_TYPE));
                }
            }
            if (library.equals(SPRING_DECLARATIVE_HTTP_INTERFACE_LIBRARY)) {
                this.setReactive(convertPropertyToBoolean(REACTIVE));
                if (additionalProperties.containsKey(USE_FLOW_FOR_ARRAY_RETURN_TYPE)) {
                    this.setUseFlowForArrayReturnType(convertPropertyToBoolean(USE_FLOW_FOR_ARRAY_RETURN_TYPE));
                }
                if (this.isUseFlowForArrayReturnType()) {
                    {
                        throw new IllegalArgumentException("Additional property '" + USE_FLOW_FOR_ARRAY_RETURN_TYPE + "' must be set to 'false' as it is not supported by Spring declarative HTTP interface");

View on GitHub (pinned to fcec517be3)

Solutions

  1. Remove the `reactive` additional property entirely from commands/option maps targeting library=spring-cloud (note: `reactive=false` also triggers the throw).
  2. If reactive (WebFlux) server generation is required, switch to `library=spring-boot` which fully supports reactive=true.
  3. Parameterize your build so shared option sets are filtered per-library instead of applied verbatim.

Example fix

# before
openapi-generator-cli generate -g kotlin-spring -i api.yaml \
  --additional-properties library=spring-cloud,reactive=true
# after (option 1: drop reactive)
openapi-generator-cli generate -g kotlin-spring -i api.yaml \
  --additional-properties library=spring-cloud
# after (option 2: reactive server)
openapi-generator-cli generate -g kotlin-spring -i api.yaml \
  --additional-properties library=spring-boot,reactive=true
Defensive patterns

Strategy: validation

Validate before calling

// reject reactive for spring-cloud before invoking the generator
if ("spring-cloud".equals(opts.get("library")) && opts.containsKey("reactive")) {
    throw new IllegalArgumentException(
        "reactive (any value, even false) is not accepted with library=spring-cloud");
}

Try / catch

try {
    new DefaultGenerator().opts(clientOptInput).generate();
} catch (IllegalArgumentException e) {
    throw new BuildException("Invalid kotlin-spring options: " + e.getMessage(), e);
}

Prevention

When it happens

Trigger: Running `-g kotlin-spring` with `--additional-properties library=spring-cloud,reactive=true` (the check fires on any presence of the `reactive` key, even `reactive=false`). Typical context: also passing useFlowForArrayReturnType or coroutine options intended for the spring-boot library.

Common situations: Porting a working reactive spring-boot server config to a spring-cloud setup; enabling reactive globally in a shared options map/Gradle convention plugin that is reused across modules with different `library` values; upgrading configs where reactive was added by a template.

Related errors


AI-assisted analysis of OpenAPITools/openapi-generator@fcec517be3 (2026-08-22). Data as JSON: /api/errors/e609cfdac9702dda. Report an issue: GitHub.