OpenAPITools/openapi-generator · error · IllegalArgumentException
useJspecify is only suppored in these libraries: {JSPECIFY_S
Error message
useJspecify is only suppored in these libraries: {JSPECIFY_SUPPORTED_LIBRARIES} What it means
Error "useJspecify is only suppored in these libraries: {JSPECIFY_SUPPORTED_LIBRARIES}" thrown in OpenAPITools/openapi-generator.
Source
Thrown at modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java:346
// Ensure the OAS 3.x discriminator mappings include any descendent schemas that allOf
// inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values,
// and the discriminator mapping schemas in the OAS document.
this.setLegacyDiscriminatorBehavior(false);
initMpRestClientVersionToRootPackage();
}
private void initMpRestClientVersionToRootPackage() {
mpRestClientVersions.put("1.4.1", new MpRestClientVersion("javax", "pom.mustache"));
mpRestClientVersions.put("2.0", new MpRestClientVersion("javax", "pom.mustache"));
mpRestClientVersions.put("3.0", new MpRestClientVersion("jakarta", "pom_3.0.mustache"));
}
@Override
public void setUseJspecify(boolean useJspecify) {
// currently only available for a limited set of libraries
if (useJspecify && !JSPECIFY_SUPPORTED_LIBRARIES.contains(library)) {
throw new IllegalArgumentException("useJspecify is only suppored in these libraries: " + JSPECIFY_SUPPORTED_LIBRARIES);
}
super.setUseJspecify(useJspecify);
}
@Override
public CodegenType getTag() {
return CodegenType.CLIENT;
}
@Override
public String getName() {
return "java";
}
@Override
public String getHelp() {
return "Generates a Java client library (HTTP lib: Jersey (1.x, 2.x), Retrofit (2.x), OpenFeign (10.x) and more.";
}View on GitHub (pinned to fcec517be3)
Solutions
- Set useJspecify only with one of the libraries listed in JSPECIFY_SUPPORTED_LIBRARIES, or remove the useJspecify option.
When it happens
Trigger: Thrown when useJspecify=true is set for the Java client generator with a library that does not support JSpecify annotations. Use one of the libraries listed in the message.
Common situations: See trigger scenarios.
AI-assisted analysis of OpenAPITools/openapi-generator@fcec517be3 (2026-08-22).
Data as JSON: /api/errors/4921125ac80fd87f.
Report an issue: GitHub.