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
Thrown when useJackson3=true but useSpringBoot4 is false. Jackson 3 lives under tools.jackson.* packages and is only on the classpath of Spring Boot 4; earlier Boot versions ship Jackson 2 (com.fasterxml.*). The generator will not emit Jackson 3 imports against a Boot 2/3 project.
Source
Thrown at modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java:669
}
if (!isUseSpringBoot4()) {
throw new IllegalArgumentException(CLIENT_REGISTRATION_ID + " requires " + USE_SPRING_BOOT4 + "=true because @ClientRegistrationId is provided by Spring Security 7");
}
}
if (useSpringSecurityPreAuthorize && !SPRING_BOOT.equals(library)) {
throw new IllegalArgumentException(USE_SPRING_SECURITY_PRE_AUTHORIZE
+ " is only supported with the " + SPRING_BOOT + " library");
}
if (isUseSpringBoot3() || isUseSpringBoot4()) {
if (AnnotationLibrary.SWAGGER1.equals(getAnnotationLibrary())) {
throw new IllegalArgumentException(AnnotationLibrary.SWAGGER1.getPropertyName() + " is not supported with Spring Boot > 3.x");
}
useJakartaEe = true;
applyJakartaPackage();
}
if(isUseJackson3() && !isUseSpringBoot4()){
throw new IllegalArgumentException("useJackson3 is only available with Spring Boot >= 4");
}
if(this.useJackson3){
this.applyJackson3Package();
} else {
this.applyJackson2Package();
}
convertPropertyToStringAndWriteBack(RESOURCE_FOLDER, this::setResourceFolder);
convertPropertyToBooleanAndWriteBack(USE_HTTP_SERVICE_PROXY_FACTORY_INTERFACES_CONFIGURATOR, this::setUseHttpServiceProxyFactoryInterfacesConfigurator);
convertPropertyToBooleanAndWriteBack(ADDITIONAL_NOT_NULL_ANNOTATIONS, this::setAdditionalNotNullAnnotations);
convertPropertyToBooleanAndWriteBack(SUBSTITUTE_GENERIC_PAGED_MODEL, this::setSubstituteGenericPagedModel);
convertPropertyToBooleanAndWriteBack(CodegenConstants.USE_ENUM_VALUE_INTERFACE, this::setUseEnumValueInterface);
if (SPRING_BOOT.equals(library)) {
convertPropertyToBooleanAndWriteBack(AUTO_X_SPRING_PAGINATED, this::setAutoXSpringPaginated);
convertPropertyToBooleanAndWriteBack(GENERATE_SORT_VALIDATION, this::setGenerateSortValidation);View on GitHub (pinned to fcec517be3)
Solutions
- Add -DuseSpringBoot4=true when enabling useJackson3.
- Or remove useJackson3 to stay on Jackson 2 with Boot 2/3 until the project upgrades.
Example fix
# before -DuseSpringBoot3=true -DuseJackson3=true # after -DuseSpringBoot4=true -DuseJackson3=true
Defensive patterns
Strategy: validation
Validate before calling
# bash if [ "$USE_JACKSON3" = "true" ] && [ "$USE_SPRING_BOOT4" != "true" ]; then echo "useJackson3 requires useSpringBoot4=true" >&2; exit 1 fi
Try / catch
// Java
try {
new DefaultGenerator().opts(input).generate();
} catch (IllegalArgumentException e) {
// message names the conflicting option; align jackson/Boot flags and rerun
} Prevention
- Upgrade Boot major version and Jackson major version in the same coordinated change.
- Keep a matrix of generator option -> required Spring Boot level in project docs.
- Run generation in CI with the same options used locally to catch drift.
When it happens
Trigger: -DuseJackson3=true without -DuseSpringBoot4=true. Note that useSpringBoot3=true alone does not satisfy the check.
Common situations: Migrating to Jackson 3 for virtual-thread / null-handling improvements while the project is still on Boot 3; enabling useJackson3 because a dependency uses Jackson 3 without realising the generator ties it to Boot 4.
Related errors
- useJackson3 is only supported for the 'native', 'apache-http
- Unexpected serializationLibrary value: {serializationLibrary
- Unexpected serializationLibrary value: {serializationLibrary
- Unexpected serializationLibrary value: {serializationLibrary
- {serializationLibrary} is an invalid enum property naming op
AI-assisted analysis of OpenAPITools/openapi-generator@fcec517be3 (2026-08-22).
Data as JSON: /api/errors/60e371eedf795e7e.
Report an issue: GitHub.