OpenAPITools/openapi-generator · error · IllegalArgumentException
useJackson3 is only available with Spring Boot >= 4
Error message
useJackson3 is only available with Spring Boot >= 4
What it means
Jackson 3 (tools.jackson) support in kotlin-spring is gated on Spring Boot 4, because Boot 3's dependency management has no Jackson 3 artifacts. After the Boot-version checks, processOpts() throws an IllegalArgumentException when isUseJackson3() is true and isUseSpringBoot4() is false (KotlinSpringServerCodegen.java:851) — covering both the Boot 3 case and the case where neither version flag is set.
Source
Thrown at modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinSpringServerCodegen.java:851
writePropertyBack(GENERATE_SORT_VALIDATION, generateSortValidation);
if (additionalProperties.containsKey(GENERATE_PAGEABLE_CONSTRAINT_VALIDATION) && library.equals(SPRING_BOOT)) {
this.setGeneratePageableConstraintValidation(convertPropertyToBoolean(GENERATE_PAGEABLE_CONSTRAINT_VALIDATION));
}
writePropertyBack(GENERATE_PAGEABLE_CONSTRAINT_VALIDATION, generatePageableConstraintValidation);
if (additionalProperties.containsKey(SUBSTITUTE_GENERIC_PAGED_MODEL)) {
this.setSubstituteGenericPagedModel(convertPropertyToBoolean(SUBSTITUTE_GENERIC_PAGED_MODEL));
}
writePropertyBack(SUBSTITUTE_GENERIC_PAGED_MODEL, substituteGenericPagedModel);
if (additionalProperties.containsKey(CodegenConstants.USE_ENUM_VALUE_INTERFACE)) {
this.setUseEnumValueInterface(convertPropertyToBoolean(CodegenConstants.USE_ENUM_VALUE_INTERFACE));
}
writePropertyBack(CodegenConstants.USE_ENUM_VALUE_INTERFACE, useEnumValueInterface);
if (isUseSpringBoot3() && isUseSpringBoot4()) {
throw new IllegalArgumentException("Choose between Spring Boot 3 and Spring Boot 4");
}
if (isUseJackson3() && !isUseSpringBoot4()) {
throw new IllegalArgumentException("useJackson3 is only available with Spring Boot >= 4");
}
if (additionalProperties.containsKey(CodegenConstants.OPENAPI_NULLABLE)) {
this.setOpenApiNullable(convertPropertyToBoolean(CodegenConstants.OPENAPI_NULLABLE));
}
writePropertyBack(CodegenConstants.OPENAPI_NULLABLE, openApiNullable);
if (isUseSpringBoot3() || isUseSpringBoot4()) {
if (AnnotationLibrary.SWAGGER1.equals(getAnnotationLibrary())) {
throw new IllegalArgumentException(AnnotationLibrary.SWAGGER1.getPropertyName() + " is not supported with Spring Boot > 3.x");
}
useJakartaEe = true;
additionalProperties.put(USE_JAKARTA_EE, useJakartaEe);
applyJakartaPackage();
}
writePropertyBack(USE_SPRING_BOOT3, isUseSpringBoot3());
writePropertyBack(USE_SPRING_BOOT4, isUseSpringBoot4());
View on GitHub (pinned to fcec517be3)
Solutions
- Upgrade the target: `--additional-properties useSpringBoot4=true,useJackson3=true`.
- Or stay on Boot 3 and remove `useJackson3` to keep Jackson 2 generation.
- Confirm the generated build files reference the expected Jackson version after regeneration.
Example fix
# before openapi-generator-cli generate -g kotlin-spring -i api.yaml \ --additional-properties useSpringBoot3=true,useJackson3=true # after openapi-generator-cli generate -g kotlin-spring -i api.yaml \ --additional-properties useSpringBoot4=true,useJackson3=true
Defensive patterns
Strategy: validation
Validate before calling
boolean jackson3 = Boolean.parseBoolean(String.valueOf(opts.getOrDefault("useJackson3", "false")));
boolean sb4 = Boolean.parseBoolean(String.valueOf(opts.getOrDefault("useSpringBoot4", "false")));
if (jackson3 && !sb4) {
throw new IllegalArgumentException("useJackson3 requires useSpringBoot4=true");
} Try / catch
try {
new DefaultGenerator().opts(clientOptInput).generate();
} catch (IllegalArgumentException e) {
throw new BuildException("Invalid kotlin-spring options: " + e.getMessage(), e);
} Prevention
- Treat useJackson3 as part of a Boot 4 upgrade, not an independent toggle.
- Gate jackson3 flags behind the same build profile that raises the Boot version.
- Verify generated build files reference the expected Jackson group/artifact after generation.
When it happens
Trigger: Running with `--additional-properties useSpringBoot3=true,useJackson3=true`, or `useJackson3=true` alone with no Boot version flag (the check requires isUseSpringBoot4() to be true).
Common situations: Trying Jackson 3 on an existing Boot 3 service; enabling useJackson3 from release-note examples without upgrading the Boot flags; build pipelines that add useJackson3 globally while some modules still target Boot 3.
Related errors
- The [%s] documentation provider does not support [%s] as com
- Currently, reactive option doesn't supported by Spring Cloud
- Additional property 'useFlowForArrayReturnType' must be set
- Choose between Spring Boot 3 and Spring Boot 4
- swagger1AnnotationLibrary is not supported with Spring Boot
AI-assisted analysis of OpenAPITools/openapi-generator@fcec517be3 (2026-08-22).
Data as JSON: /api/errors/d994c1f3e859bbe9.
Report an issue: GitHub.