{"record":{"id":"eb5ed8ae6035e126","repo":"OpenAPITools/openapi-generator","slug":"the-annotation-library-s-is-not-supported-by-th","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/AbstractJavaCodegen.java","lineNumber":435,"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","sourceCodeStart":417,"sourceCodeEnd":453,"githubUrl":"https://github.com/OpenAPITools/openapi-generator/blob/fcec517be3cf5b7964296bcba25fbc97541484e7/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java#L417-L453","documentation":"AbstractJavaCodegen.processOpts throws IllegalArgumentException when the annotationLibrary option is a valid value (none, swagger1, swagger2, microprofile) but the concrete generator does not include it in supportedAnnotationLibraries(). The check runs after the documentation provider is resolved, since the provider picks a preferred default library.","triggerScenarios":"Passing -p annotationLibrary=microprofile to a Java generator whose supportedAnnotationLibraries() excludes it; note the resolved default comes from documentationProvider.getPreferredAnnotationLibrary() when the option is absent, so a generator/provider pairing can also drag in an unsupported default.","commonSituations":"Reusing option blocks between Java generators that support different annotation libraries; requesting swagger1 annotations on a generator that only supports swagger2; version upgrades that narrowed the supported set.","solutions":["Choose an annotation library the specific generator supports (see the generator's docs/help).","Drop the annotationLibrary option and let the documentation provider's preferred library apply.","If the library is a hard requirement, pick a generator that supports it."],"exampleFix":"# before (generator supports only swagger2):\nopenapi-generator-cli generate -g java -i api.yaml -p annotationLibrary=microprofile\n# after:\nopenapi-generator-cli generate -g java -i api.yaml -p annotationLibrary=swagger2","handlingStrategy":"validation","validationCode":"// Programmatic use: verify against the generator instance before setting options\nString lib = (String) additionalProperties.getOrDefault(\"annotationLibrary\",\n        provider.getPreferredAnnotationLibrary().toCliOptValue());\nAnnotationLibrary parsedLib = AnnotationLibrary.ofCliOption(lib.toUpperCase(Locale.ROOT));\nif (!gen.supportedAnnotationLibraries().contains(parsedLib))\n    throw new IllegalArgumentException(\"Pick from: \" + gen.supportedAnnotationLibraries());","typeGuard":"const ANNOTATION_LIBRARIES = ['none', 'swagger1', 'swagger2', 'microprofile'] as const;\nexport type AnnotationLibrary = typeof ANNOTATION_LIBRARIES[number];\nexport function isAnnotationLibrary(v: string): v is AnnotationLibrary {\n    return (ANNOTATION_LIBRARIES as readonly string[]).includes(v);\n}\n// NOTE: still verify the concrete generator's supportedAnnotationLibraries() set.","tryCatchPattern":null,"preventionTips":["Treat annotationLibrary as generator-specific; do not copy it between generators blindly.","Prefer omitting annotationLibrary so the provider's preferred library is used.","When a generator changes its default provider across versions, re-check pinned library options."],"tags":["openapi","java","annotation-library","configuration"],"backgroundTag":"unsupported-generator-option","analyzedSha":"fcec517be3cf5b7964296bcba25fbc97541484e7","analyzedAt":"2026-08-22T11:13:11.613Z","schemaVersion":2},"datasetVersion":"2026-08-22T14:17:55.899Z"}