{"record":{"id":"8a3f4b3cf6463b72","repo":"OpenAPITools/openapi-generator","slug":"the-annotation-library-s-is-not-supported-by-th-8a3f4b","errorCode":null,"errorMessage":"The Annotation Library [%s] is not supported by this generator","messagePattern":"The Annotation Library \\[(.+?)\\] is not supported by this generator","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinSpringServerCodegen.java","lineNumber":541,"sourceCode":"                            defaultDocumentationProvider().toCliOptValue())\n            );\n\n            if (!supportedDocumentationProvider().contains(documentationProvider)) {\n                String msg = String.format(Locale.ROOT,\n                        \"The [%s] Documentation Provider is not supported by this generator\",\n                        documentationProvider.toCliOptValue());\n                throw new IllegalArgumentException(msg);\n            }\n\n            annotationLibrary = AnnotationLibrary.ofCliOption(\n                    (String) additionalProperties.getOrDefault(ANNOTATION_LIBRARY,\n                            documentationProvider.getPreferredAnnotationLibrary().toCliOptValue())\n            );\n\n            if (!supportedAnnotationLibraries().contains(annotationLibrary)) {\n                String msg = String.format(Locale.ROOT, \"The Annotation Library [%s] is not supported by this generator\",\n                        annotationLibrary.toCliOptValue());\n                throw new IllegalArgumentException(msg);\n            }\n\n            if (!documentationProvider.supportedAnnotationLibraries().contains(annotationLibrary)) {\n                String msg = String.format(Locale.ROOT,\n                        \"The [%s] documentation provider does not support [%s] as complementary annotation library\",\n                        documentationProvider.toCliOptValue(), annotationLibrary.toCliOptValue());\n                throw new IllegalArgumentException(msg);\n            }\n\n            additionalProperties.put(DOCUMENTATION_PROVIDER, documentationProvider.toCliOptValue());\n            additionalProperties.put(documentationProvider.getPropertyName(), true);\n            additionalProperties.put(ANNOTATION_LIBRARY, annotationLibrary.toCliOptValue());\n            additionalProperties.put(annotationLibrary.getPropertyName(), true);\n        } else {\n            additionalProperties.put(DOCUMENTATION_PROVIDER, DocumentationProvider.NONE);\n            additionalProperties.put(ANNOTATION_LIBRARY, AnnotationLibrary.NONE);\n        }\n        if (additionalProperties.containsKey(USE_SPRING_BOOT3)) {","sourceCodeStart":523,"sourceCodeEnd":559,"githubUrl":"https://github.com/OpenAPITools/openapi-generator/blob/fcec517be3cf5b7964296bcba25fbc97541484e7/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinSpringServerCodegen.java#L523-L559","documentation":"kotlin-spring accepts only 'none', 'swagger1' and 'swagger2' as annotation libraries (supportedAnnotationLibraries() at KotlinSpringServerCodegen.java:442). In processOpts() the CLI value is parsed via AnnotationLibrary.ofCliOption() and, if it is a valid enum constant this generator does not offer (e.g. 'javadoc'), an IllegalArgumentException is thrown. Values are upper-cased before matching, so case is not the issue — the value itself must be one of the three.","triggerScenarios":"Running `-g kotlin-spring` with `--additional-properties annotationLibrary=javadoc` (javadoc is a valid AnnotationLibrary used by other generators but not listed for kotlin-spring). Unrecognized strings fail earlier in valueOf() with a 'No enum constant' message instead of this one.","commonSituations":"Reusing java-spring or another generator's configOptions (where javadoc is supported) in a kotlin-spring Maven/Gradle plugin block; disabling annotation processing and guessing the option name for plain Javadoc output.","solutions":["Pick a supported value: `annotationLibrary=swagger2` (the springdoc default), `swagger1`, or `none`.","If you need javadoc-style output, use a generator whose supportedAnnotationLibraries() includes javadoc (check with `config-help -g <lang>`).","Run `openapi-generator-cli config-help -g kotlin-spring` and copy the enumerated values verbatim."],"exampleFix":"# before\nopenapi-generator-cli generate -g kotlin-spring -i api.yaml \\\n  --additional-properties annotationLibrary=javadoc\n# after\nopenapi-generator-cli generate -g kotlin-spring -i api.yaml \\\n  --additional-properties annotationLibrary=swagger2","handlingStrategy":"validation","validationCode":"// allow-list mirrors supportedAnnotationLibraries() for kotlin-spring\nSet<String> supported = Set.of(\"NONE\", \"SWAGGER1\", \"SWAGGER2\");\nString al = String.valueOf(opts.getOrDefault(\"annotationLibrary\", \"SWAGGER2\"))\n        .toUpperCase(Locale.ROOT);\nif (!supported.contains(al)) {\n    throw new IllegalArgumentException(\n        \"kotlin-spring annotationLibrary must be one of \" + supported);\n}","typeGuard":null,"tryCatchPattern":"try {\n    new DefaultGenerator().opts(clientOptInput).generate();\n} catch (IllegalArgumentException e) {\n    // message names the rejected annotation library\n    throw new BuildException(\"Invalid kotlin-spring options: \" + e.getMessage(), e);\n}","preventionTips":["Check config-help output per generator before adding annotationLibrary to options.","Prefer omitting annotationLibrary so it defaults to the provider's preferred library.","Centralize generator options in one module and review them on generator upgrades."],"tags":["kotlin","spring","annotation-library","swagger","additional-properties","openapi-generator","config-validation"],"backgroundTag":"unsupported-option-value","analyzedSha":"fcec517be3cf5b7964296bcba25fbc97541484e7","analyzedAt":"2026-08-22T11:13:11.613Z","schemaVersion":2},"datasetVersion":"2026-08-22T14:17:55.899Z"}