{"record":{"id":"a07f03198e4221b2","repo":"OpenAPITools/openapi-generator","slug":"openapinullable-cannot-be-set-with-usejackson3","errorCode":null,"errorMessage":"openApiNullable cannot be set with useJackson3","messagePattern":"openApiNullable cannot be set with useJackson3","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinClientCodegen.java","lineNumber":498,"sourceCode":"            setUseJackson3(true);\n            additionalProperties.put(USE_JACKSON_3, true);\n            applyJackson3Package();\n        }\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","sourceCodeStart":480,"sourceCodeEnd":516,"githubUrl":"https://github.com/OpenAPITools/openapi-generator/blob/fcec517be3cf5b7964296bcba25fbc97541484e7/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinClientCodegen.java#L480-L516","documentation":"Jackson 3 moved to the tools.jackson packages, and the org.openapitools.jackson.nullable (jackson-databind-nullable) helper the openApiNullable option emits is Jackson-2 only — so openApiNullable=true is rejected while useJackson3 is enabled. The guard only fires when the property is present AND Boolean.parseBoolean(toString(value)) is true; openApiNullable=false is explicitly fine.","triggerScenarios":"`-g kotlin -p useJackson3=true,openApiNullable=true`; or jvm-spring-restclient + useSpringBoot4=true (which auto-enables useJackson3, KotlinClientCodegen.java:479-481) while a shared config file still carries openApiNullable: true.","commonSituations":"Corporate option presets that always pass openApiNullable=true colliding with a Boot 4 / Jackson 3 migration; copy-pasted option lists across generators.","solutions":["Remove `openApiNullable` or set it explicitly to `false` when using Jackson 3.","Or drop useJackson3 / stay on Jackson 2 (serializationLibrary=jackson without the useJackson3 flag) to keep JsonNullable wrappers.","Purge the option from shared CI config templates before enabling useJackson3."],"exampleFix":"# before\nopenapi-generator-cli generate -g kotlin --library=jvm-okhttp4 -i api.yaml -p useJackson3=true,openApiNullable=true\n# after\nopenapi-generator-cli generate -g kotlin --library=jvm-okhttp4 -i api.yaml -p useJackson3=true,openApiNullable=false","handlingStrategy":"validation","validationCode":"# shell: reject the forbidden combo up front\nif [ \"$USE_JACKSON_3\" = \"true\" ] && [ \"$OPEN_API_NULLABLE\" = \"true\" ]; then\n  echo \"openApiNullable=true is incompatible with useJackson3=true\" >&2; exit 2\nfi","typeGuard":null,"tryCatchPattern":"try {\n    DefaultGenerator().opts(clientOptInput).generate()\n} catch (e: IllegalArgumentException) {\n    throw IllegalStateException(\"Incompatible kotlin generator options: ${e.message}\", e)\n}","preventionTips":["Set openApiNullable=false explicitly when enabling useJackson3.","Purge legacy option presets before a Boot 4 / Jackson 3 migration.","Note the guard accepts openApiNullable=false — explicit false is the safe sentinel."],"tags":["openapi-generator","kotlin","jackson","nullable","configuration"],"backgroundTag":"incompatible-generator-options","analyzedSha":"fcec517be3cf5b7964296bcba25fbc97541484e7","analyzedAt":"2026-08-22T11:13:11.613Z","schemaVersion":2},"datasetVersion":"2026-08-22T14:17:55.899Z"}