OpenAPITools/openapi-generator · error · ResponseStatusException
Unsupported target " + language + " supplied
Error message
Unsupported target " + language + " supplied
What it means
Thrown by the generate endpoints (POST /api/gen/clients/{language}, /api/gen/servers/{framework}) when CodegenConfigLoader.forName(language) throws a RuntimeException during generation (Generator.java:124-129). Same root cause as error 284 but surfaced at the generate step, as a 400 without the loader's exception detail. The language name must exactly match a generator discovered on the server's classpath via the CodegenConfig service registry.
Source
Thrown at modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/service/Generator.java:128
throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "The OpenAPI specification supplied was not valid");
}
// do not use opts.getOptions().get("outputFolder") as the input can contain ../../
// to access other folders in the server
String destPath = language + "-" + type.getTypeName();
ClientOptInput clientOptInput = new ClientOptInput();
String outputFolder = getTmpFolder().getAbsolutePath() + File.separator + destPath;
String outputFilename = outputFolder + "-bundle.zip";
clientOptInput.openAPI(openapi);
CodegenConfig codegenConfig;
try {
codegenConfig = CodegenConfigLoader.forName(language);
} catch (RuntimeException e) {
throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Unsupported target " + language + " supplied");
}
if (opts.getOptions() != null) {
codegenConfig.additionalProperties().putAll(opts.getOptions());
codegenConfig.additionalProperties().put("openAPI", openapi);
}
if (opts.getOpenapiNormalizer() != null && !opts.getOpenapiNormalizer().isEmpty()) {
for (String rule : opts.getOpenapiNormalizer()) {
String[] ruleOperands = rule.split("=");
if (ruleOperands.length != 2) {
throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "In rule: " + rule + "the operands were not provided in the form of <Rule>=<Value>");
}
codegenConfig.openapiNormalizer().put(ruleOperands[0], ruleOperands[1]);
}
}
codegenConfig.setOutputDir(outputFolder);View on GitHub (pinned to fcec517be3)
Solutions
- GET /api/gen/clients or /api/gen/servers and use a listed name verbatim (case-sensitive)
- Pin your client's generator names to the same openapi-generator release as the server; consult that release's generator list docs
- For custom generators, ensure the jar plus META-INF/services entry is present in the deployed image and the name matches getName()
- Note the sibling lookup endpoints (/options) return 404 with the loader cause — useful for diagnosing classpath vs typo
Example fix
# before
curl -s -X POST "$host/api/gen/clients/jav" -d '{"openAPIUrl":"https://.../openapi.json"}' \
-H 'Content-Type: application/json' # 400 Unsupported target jav supplied
# after
curl -s "$host/api/gen/clients" | jq -e 'index("java")' >/dev/null || exit 1
curl -s -X POST "$host/api/gen/clients/java" -d '{"openAPIUrl":"https://.../openapi.json"}' \
-H 'Content-Type: application/json' Defensive patterns
Strategy: validation
Validate before calling
// same guard as the options endpoint, run before generating
List<String> valid = type == CLIENT ? fetch("/api/gen/clients") : fetch("/api/gen/servers");
if (!valid.contains(language)) {
throw new IllegalArgumentException(language + " not in " + valid);
} Type guard
boolean canGenerate(String name, List<String> validNames) {
return name != null && validNames.contains(name); // exact, case-sensitive match
} Try / catch
catch (HttpClientErrorException.BadRequest e) {
if (e.getResponseBodyAsString().contains("Unsupported target")) refreshGeneratorList(); // names drifted, re-sync
} Prevention
- Validate against the live /api/gen/clients|servers list at startup, not a hardcoded copy
- Pin client and server to the same openapi-generator release line
When it happens
Trigger: POST /api/gen/clients/jav/... with a typo'd name; using a generator that was removed/renamed in the deployed openapi-generator version ('python2', 'lumen', old 'swift' on recent releases); case mismatch ('Spring' vs 'spring'); asking /gen/clients/ for a server-only generator or vice versa; custom generator jar missing from a self-hosted image.
Common situations: Client code pinned to generator names that drift across openapi-generator releases; scripts written against an older self-hosted version then pointed at a newer one; copy-pasted examples from outdated docs.
Related errors
- Unsupported target %s supplied. %s
- Framework is required
- No options were supplied
- No OpenAPI specification was supplied
- The OpenAPI specification supplied was not valid
AI-assisted analysis of OpenAPITools/openapi-generator@fcec517be3 (2026-08-22).
Data as JSON: /api/errors/63c25a6a92d67a5d.
Report an issue: GitHub.