{"record":{"id":"9d7623c58ea2b37a","repo":"OpenAPITools/openapi-generator","slug":"no-options-were-supplied","errorCode":null,"errorMessage":"No options were supplied","messagePattern":"No options were 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":79,"sourceCode":"        }\n\n        String getTypeName() {\n            return name;\n        }\n    }\n\n    public static String generateClient(String language, GeneratorInput opts) {\n        return generate(language, opts, Type.CLIENT);\n    }\n\n    public static String generateServer(String language, GeneratorInput opts) {\n        return generate(language, opts, Type.SERVER);\n    }\n\n    private static String generate(String language, GeneratorInput opts, Type type) {\n        LOGGER.debug(String.format(Locale.ROOT, \"generate %s for %s\", type.getTypeName(), language));\n        if (opts == null) {\n            throw new ResponseStatusException(HttpStatus.BAD_REQUEST, \"No options were supplied\");\n        }\n        JsonNode node = opts.getSpec();\n        if (node != null && \"{}\".equals(node.toString())) {\n            LOGGER.debug(\"ignoring empty spec\");\n            node = null;\n        }\n        OpenAPI openapi;\n        ParseOptions parseOptions = new ParseOptions();\n        parseOptions.setResolve(true);\n        if (node == null) {\n            if (opts.getOpenAPIUrl() != null) {\n                if (opts.getAuthorizationValue() != null) {\n                    List<AuthorizationValue> authorizationValues = new ArrayList<>();\n                    authorizationValues.add(opts.getAuthorizationValue());\n                    openapi = new OpenAPIParser().readLocation(opts.getOpenAPIUrl(), authorizationValues, parseOptions).getOpenAPI();\n                } else {\n                    openapi = new OpenAPIParser().readLocation(opts.getOpenAPIUrl(), null, parseOptions).getOpenAPI();\n                }","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/OpenAPITools/openapi-generator/blob/fcec517be3cf5b7964296bcba25fbc97541484e7/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/service/Generator.java#L61-L97","documentation":"Thrown by POST /api/gen/clients/{language} and /api/gen/servers/{framework} when the request carries no GeneratorInput at all, i.e. opts == null at Generator.java:78-80. The generator deliberately refuses to guess: even though a spec could theoretically be required later, an entirely missing body/options object is rejected up front with 400 'No options were supplied'. Note that a JSON body of {} will NOT hit this — it fails later at 286 instead.","triggerScenarios":"POST with no body at all (missing -d in curl, empty fetch body); Content-Type omitted together with an empty body so Spring binds nothing; programmatic calls passing null as the GeneratorInput.","commonSituations":"Shell scripts where the -d @file.json references a missing/empty file; HTTP clients configured with body: null; copy-pasted curl commands that lost their --data flag; unit tests invoking Generator.generateClient(\"java\", null).","solutions":["Always send a JSON body with Content-Type: application/json, minimally {\"spec\": {...}} or {\"openAPIUrl\": \"...\"}","In scripts, assert the spec file exists and is non-empty before using -d @spec.json","Passing an empty object is not a workaround — it moves the failure to 'No OpenAPI specification was supplied' (286)"],"exampleFix":"# before\ncurl -s -X POST \"$host/api/gen/clients/java\" -H 'Content-Type: application/json'   # no body -> 400 No options were supplied\n\n# after\ncurl -s -X POST \"$host/api/gen/clients/java\" -H 'Content-Type: application/json' \\\n  -d \"{\\\"openAPIUrl\\\":\\\"https://petstore3.swagger.io/api/v3/openapi.json\\\"}\"","handlingStrategy":"validation","validationCode":"// never POST without a body; build the minimum valid input up front\nGeneratorInput input = new GeneratorInput();\ninput.setOpenAPIUrl(specUrl);          // or input.setSpec(specNode)\nif (input.getSpec() == null && input.getOpenAPIUrl() == null) {\n    throw new IllegalStateException(\"refusing to POST: nothing to generate from\");\n}","typeGuard":"boolean isSubmittable(GeneratorInput in) {\n    return in != null\n        && (in.getSpec() != null || in.getOpenAPIUrl() != null); // {} spec counts as null server-side\n}","tryCatchPattern":null,"preventionTips":["Always set -d/--data and Content-Type: application/json on generate POSTs","In scripts, assert [ -s spec.json ] before -d @spec.json"],"tags":["http-400","missing-body","request-binding","openapi-generator-online"],"backgroundTag":"missing-request-body","analyzedSha":"fcec517be3cf5b7964296bcba25fbc97541484e7","analyzedAt":"2026-08-22T11:13:11.613Z","schemaVersion":2},"datasetVersion":"2026-08-22T14:17:55.899Z"}