{"record":{"id":"63c25a6a92d67a5d","repo":"OpenAPITools/openapi-generator","slug":"unsupported-target-language-supplied","errorCode":null,"errorMessage":"Unsupported target \" + language + \" supplied","messagePattern":"Unsupported target \" \\+ language \\+ \" supplied","errorType":"http","errorClass":"ResponseStatusException","httpStatus":400,"severity":"error","filePath":"modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/service/Generator.java","lineNumber":128,"sourceCode":"            throw new ResponseStatusException(HttpStatus.BAD_REQUEST, \"The OpenAPI specification supplied was not valid\");\n        }\n\n\n        // do not use opts.getOptions().get(\"outputFolder\") as the input can contain ../../\n        // to access other folders in the server\n        String destPath = language + \"-\" + type.getTypeName();\n\n        ClientOptInput clientOptInput = new ClientOptInput();\n        String outputFolder = getTmpFolder().getAbsolutePath() + File.separator + destPath;\n        String outputFilename = outputFolder + \"-bundle.zip\";\n\n        clientOptInput.openAPI(openapi);\n\n        CodegenConfig codegenConfig;\n        try {\n            codegenConfig = CodegenConfigLoader.forName(language);\n        } catch (RuntimeException e) {\n            throw new ResponseStatusException(HttpStatus.BAD_REQUEST, \"Unsupported target \" + language + \" supplied\");\n        }\n\n        if (opts.getOptions() != null) {\n            codegenConfig.additionalProperties().putAll(opts.getOptions());\n            codegenConfig.additionalProperties().put(\"openAPI\", openapi);\n        }\n\n        if (opts.getOpenapiNormalizer() != null && !opts.getOpenapiNormalizer().isEmpty()) {\n            for (String rule : opts.getOpenapiNormalizer()) {\n                String[] ruleOperands = rule.split(\"=\");\n                if (ruleOperands.length != 2) {\n                    throw new ResponseStatusException(HttpStatus.BAD_REQUEST, \"In rule: \" + rule + \"the operands were not provided in the form of <Rule>=<Value>\");\n                }\n                codegenConfig.openapiNormalizer().put(ruleOperands[0], ruleOperands[1]);\n            }\n        }\n\n        codegenConfig.setOutputDir(outputFolder);","sourceCodeStart":110,"sourceCodeEnd":146,"githubUrl":"https://github.com/OpenAPITools/openapi-generator/blob/fcec517be3cf5b7964296bcba25fbc97541484e7/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/service/Generator.java#L110-L146","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"# before\ncurl -s -X POST \"$host/api/gen/clients/jav\" -d '{\"openAPIUrl\":\"https://.../openapi.json\"}' \\\n  -H 'Content-Type: application/json'   # 400 Unsupported target jav supplied\n\n# after\ncurl -s \"$host/api/gen/clients\" | jq -e 'index(\"java\")' >/dev/null || exit 1\ncurl -s -X POST \"$host/api/gen/clients/java\" -d '{\"openAPIUrl\":\"https://.../openapi.json\"}' \\\n  -H 'Content-Type: application/json'","handlingStrategy":"validation","validationCode":"// same guard as the options endpoint, run before generating\nList<String> valid = type == CLIENT ? fetch(\"/api/gen/clients\") : fetch(\"/api/gen/servers\");\nif (!valid.contains(language)) {\n    throw new IllegalArgumentException(language + \" not in \" + valid);\n}","typeGuard":"boolean canGenerate(String name, List<String> validNames) {\n    return name != null && validNames.contains(name); // exact, case-sensitive match\n}","tryCatchPattern":"catch (HttpClientErrorException.BadRequest e) {\n    if (e.getResponseBodyAsString().contains(\"Unsupported target\")) refreshGeneratorList(); // names drifted, re-sync\n}","preventionTips":["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"],"tags":["http-400","generator-name","code-gen-config-loader","openapi-generator-online"],"backgroundTag":"unsupported-generator-language","analyzedSha":"fcec517be3cf5b7964296bcba25fbc97541484e7","analyzedAt":"2026-08-22T11:13:11.613Z","schemaVersion":2},"datasetVersion":"2026-08-22T14:17:55.899Z"}