{"record":{"id":"38369a7fa15be6f8","repo":"OpenAPITools/openapi-generator","slug":"usejackson3-is-only-supported-for-the-jvm-okhttp4","errorCode":null,"errorMessage":"useJackson3 is only supported for the jvm-okhttp4 and jvm-spring-restclient libraries at this time.","messagePattern":"useJackson3 is only supported for the jvm-okhttp4 and jvm-spring-restclient libraries at this time\\.","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinClientCodegen.java","lineNumber":501,"sourceCode":"        }\n\n        if (additionalProperties.containsKey(CodegenConstants.SERIALIZATION_LIBRARY)) {\n            setSerializationLibrary((String) additionalProperties.get(CodegenConstants.SERIALIZATION_LIBRARY));\n            additionalProperties.put(this.serializationLibrary.name(), true);\n        } else {\n            additionalProperties.put(this.serializationLibrary.name(), true);\n        }\n\n        if (isUseJackson3()) {\n            if (this.serializationLibrary != SERIALIZATION_LIBRARY_TYPE.jackson) {\n                throw new IllegalArgumentException(\"useJackson3 requires serializationLibrary=jackson\");\n            }\n            if (additionalProperties.containsKey(\"openApiNullable\")\n                    && Boolean.parseBoolean(additionalProperties.get(\"openApiNullable\").toString())) {\n                throw new IllegalArgumentException(\"openApiNullable cannot be set with useJackson3\");\n            }\n            if (!JVM_OKHTTP4.equals(getLibrary()) && !JVM_SPRING_RESTCLIENT.equals(getLibrary())) {\n                throw new IllegalArgumentException(\"useJackson3 is only supported for the jvm-okhttp4 and jvm-spring-restclient libraries at this time.\");\n            }\n            if (JVM_SPRING_RESTCLIENT.equals(getLibrary()) && !useSpringBoot4) {\n                throw new IllegalArgumentException(\"useJackson3 with jvm-spring-restclient requires useSpringBoot4=true.\");\n            }\n        }\n\n        if (additionalProperties.containsKey(MAP_FILE_BINARY_TO_BYTE_ARRAY)) {\n            setMapFileBinaryToByteArray(convertPropertyToBooleanAndWriteBack(MAP_FILE_BINARY_TO_BYTE_ARRAY));\n        }\n        additionalProperties.put(MAP_FILE_BINARY_TO_BYTE_ARRAY, mapFileBinaryToByteArray);\n        if (mapFileBinaryToByteArray) {\n            typeMapping.put(\"file\", \"kotlin.ByteArray\");\n            typeMapping.put(\"binary\", \"kotlin.ByteArray\");\n        }\n\n        if (additionalProperties.containsKey(GENERATE_ONEOF_ANYOF_WRAPPERS)) {\n            setGenerateOneOfAnyOfWrappers(convertPropertyToBooleanAndWriteBack(GENERATE_ONEOF_ANYOF_WRAPPERS));\n        }","sourceCodeStart":483,"sourceCodeEnd":519,"githubUrl":"https://github.com/OpenAPITools/openapi-generator/blob/fcec517be3cf5b7964296bcba25fbc97541484e7/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinClientCodegen.java#L483-L519","documentation":"The useJackson3 codegen paths only exist for two libraries: jvm-okhttp4 and jvm-spring-restclient. The check compares getLibrary() against exactly those two constants; with any other --library value (jvm-ktor, jvm-okhttp/jvm-okhttp3, jvm-retrofit2, jvm-volley, jvm-vertx, multiplatform, and notably jvm-spring-webclient) it throws IllegalArgumentException.","triggerScenarios":"`-g kotlin --library=jvm-ktor -p useJackson3=true`; `--library=jvm-spring-webclient -p useJackson3=true` (webclient is NOT in the allowlist — only restclient); `--library=jvm-retrofit2 -p useJackson3=true`.","commonSituations":"Assuming 'jvm-spring-webclient' counts as a Spring library for Jackson 3; retrofit2 users wanting to modernize to Jackson 3; option presets shared across different --library values.","solutions":["Switch `--library` to `jvm-okhttp4` or `jvm-spring-restclient` if you need Jackson 3.","Or drop `useJackson3` and stay on Jackson 2 for the current library.","Use the exact strings 'jvm-okhttp4' and 'jvm-spring-restclient' — close spellings silently pick a different library or fail."],"exampleFix":"# before\nopenapi-generator-cli generate -g kotlin --library=jvm-spring-webclient -i api.yaml -p useJackson3=true\n# after\nopenapi-generator-cli generate -g kotlin --library=jvm-spring-restclient -i api.yaml -p useJackson3=true","handlingStrategy":"validation","validationCode":"# shell: gate useJackson3 on the two supported libraries\nif [ \"$USE_JACKSON_3\" = \"true\" ]; then\n  case \"$LIBRARY\" in\n    jvm-okhttp4|jvm-spring-restclient) ;;\n    *) echo \"useJackson3 only supports jvm-okhttp4 / jvm-spring-restclient, got library: $LIBRARY\" >&2; exit 2 ;;\n  esac\nfi","typeGuard":"// Kotlin\nval JACKSON3_LIBRARIES = setOf(\"jvm-okhttp4\", \"jvm-spring-restclient\")\nfun supportsJackson3(library: String?): Boolean = library in JACKSON3_LIBRARIES","tryCatchPattern":"try {\n    DefaultGenerator().opts(clientOptInput).generate()\n} catch (e: IllegalArgumentException) {\n    throw IllegalStateException(\"useJackson3 unsupported for the selected library: ${e.message}\", e)\n}","preventionTips":["Check library strings against the exact constants jvm-okhttp4 / jvm-spring-restclient.","Remember jvm-spring-webclient is NOT Jackson-3-capable — only restclient is.","Prefer staying on Jackson 2 unless you specifically need tools.jackson packages."],"tags":["openapi-generator","kotlin","jackson","library-selection","configuration"],"backgroundTag":"incompatible-generator-options","analyzedSha":"fcec517be3cf5b7964296bcba25fbc97541484e7","analyzedAt":"2026-08-22T11:13:11.613Z","schemaVersion":2},"datasetVersion":"2026-08-22T14:17:55.899Z"}