{"record":{"id":"f585ec49488f0aa6","repo":"OpenAPITools/openapi-generator","slug":"missing-config","errorCode":null,"errorMessage":"missing config!","messagePattern":"missing config!","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java","lineNumber":1281,"sourceCode":"            if (ProcessUtils.hasHttpBasicMethods(authMethods)) {\n                bundle.put(\"hasHttpBasicMethods\", true);\n                bundle.put(\"httpBasicMethods\", ProcessUtils.getHttpBasicMethods(authMethods));\n            }\n            if (ProcessUtils.hasApiKeyMethods(authMethods)) {\n                bundle.put(\"hasApiKeyMethods\", true);\n                bundle.put(\"apiKeyMethods\", ProcessUtils.getApiKeyMethods(authMethods));\n            }\n        }\n    }\n\n    @Override\n    public List<File> generate() {\n        if (openAPI == null) {\n            throw new RuntimeException(\"Issues with the OpenAPI input. Possible causes: invalid/missing spec, malformed JSON/YAML files, etc.\");\n        }\n\n        if (config == null) {\n            throw new RuntimeException(\"missing config!\");\n        }\n\n        if (config.getGeneratorMetadata() == null) {\n            LOGGER.warn(\"Generator '{}' is missing generator metadata!\", config.getName());\n        } else {\n            GeneratorMetadata generatorMetadata = config.getGeneratorMetadata();\n            if (StringUtils.isNotEmpty(generatorMetadata.getGenerationMessage())) {\n                LOGGER.info(generatorMetadata.getGenerationMessage());\n            }\n\n            Stability stability = generatorMetadata.getStability();\n            String stabilityMessage = String.format(Locale.ROOT, \"Generator '%s' is considered %s.\", config.getName(), stability.value());\n            if (stability == Stability.DEPRECATED) {\n                LOGGER.warn(stabilityMessage);\n            } else {\n                LOGGER.info(stabilityMessage);\n            }\n        }","sourceCodeStart":1263,"sourceCodeEnd":1299,"githubUrl":"https://github.com/OpenAPITools/openapi-generator/blob/fcec517be3cf5b7964296bcba25fbc97541484e7/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java#L1263-L1299","documentation":"The second guard in DefaultGenerator.generate(): after verifying openAPI it verifies config (the CodegenConfig carrying the generator instance and all options). A null config means opts(...) was never called or the ClientOptInput carried no CodegenConfig - practically the same setup-ordering bug as error [8], just one check later. It cannot fire if openAPI was also null (the first guard throws first), so seeing it means a spec WAS attached but the generator config was not.","triggerScenarios":"Calling generate() after a partial setup that set the spec but not the generator (hand-built ClientOptInput with only openAPI set); a wrapper that built CodegenConfigurator but called toClientOptInput() before setGeneratorName so CodegenConfigLoader never ran; error-path code that reuses a half-configured generator instance.","commonSituations":"Programmatic integrations migrating between openapi-generator versions whose ClientOptInput shape changed; test scaffolding that constructs input objects directly; on-demand generation services that short-circuit config construction on a cached-spec path.","solutions":["Use CodegenConfigurator end-to-end: set inputSpec AND generatorName, then toClientOptInput() - this loads the CodegenConfig via CodegenConfigLoader.forName and never leaves config null.","If wiring manually, ensure ClientOptInput's config is set from CodegenConfigLoader.forName(generatorName) before generator.opts(input).","Guard your own code: assert input.getConfig() != null && input.getOpenAPI() != null before calling generate() so misuse fails with your own message.","On the CLI, pass both -i <spec> and -g <generator>."],"exampleFix":"// before\nClientOptInput input = new ClientOptInput();\ninput.setOpenAPI(parsedSpec);\nnew DefaultGenerator().opts(input).generate(); // missing config!\n// after\nClientOptInput input = new ClientOptInput();\ninput.setOpenAPI(parsedSpec);\ninput.setConfig(CodegenConfigLoader.forName(\"java\"));\nnew DefaultGenerator().opts(input).generate();","handlingStrategy":"validation","validationCode":"// Assert the pipeline is fully wired before generate()\nObjects.requireNonNull(input.getOpenAPI(), \"spec missing\");\nObjects.requireNonNull(input.getConfig(), \"generator config missing (set generatorName)\");\nnew DefaultGenerator().opts(input).generate();","typeGuard":null,"tryCatchPattern":"try {\n    new DefaultGenerator().opts(input).generate();\n} catch (RuntimeException e) {\n    if (\"missing config!\".equals(e.getMessage())) {\n        // CodegenConfigLoader never ran: set generatorName on CodegenConfigurator and rebuild input\n        throw new IllegalStateException(\"ClientOptInput built without CodegenConfig\", e);\n    }\n    throw e;\n}","preventionTips":["Use CodegenConfigurator with BOTH setInputSpec and setGeneratorName before toClientOptInput().","Never reuse a ClientOptInput across different generator configurations.","Add unit coverage for your generation entrypoint so setup regressions fail in tests, not production."],"tags":["openapi-generator","programmatic-usage","api-misuse","java"],"backgroundTag":"missing-required-configuration","analyzedSha":"fcec517be3cf5b7964296bcba25fbc97541484e7","analyzedAt":"2026-08-22T11:13:11.613Z","schemaVersion":2},"datasetVersion":"2026-08-22T14:17:55.899Z"}