{"record":{"id":"fe04de41fb0569bd","repo":"OpenAPITools/openapi-generator","slug":"empty-method-name-operationid-not-allowed-fe04de","errorCode":null,"errorMessage":"Empty method name (operationId) not allowed","messagePattern":"Empty method name \\(operationId\\) not allowed","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaLagomServerCodegen.java","lineNumber":174,"sourceCode":"    public CodegenType getTag() {\n        return CodegenType.SERVER;\n    }\n\n    @Override\n    public String getName() {\n        return \"scala-lagom-server-deprecated\";\n    }\n\n    @Override\n    public String getHelp() {\n        return \"Generates a Lagom API server (Beta) in scala. IMPORTANT: this generator has been deprecated\";\n    }\n\n    @Override\n    public String toOperationId(String operationId) {\n        // throw exception if method name is empty\n        if (StringUtils.isEmpty(operationId)) {\n            throw new RuntimeException(\"Empty method name (operationId) not allowed\");\n        }\n\n        // method name cannot use reserved keyword, e.g. return\n        if (isReservedWord(operationId)) {\n            throw new RuntimeException(operationId + \" (reserved word) cannot be used as method name\");\n        }\n\n        return camelize(operationId, LOWERCASE_FIRST_LETTER);\n    }\n\n    @Override\n    public ModelsMap postProcessModelsEnum(ModelsMap objs) {\n        objs = super.postProcessModelsEnum(objs);\n        for (ModelMap mo : objs.getModels()) {\n            CodegenModel cm = mo.getModel();\n\n            for (CodegenProperty var : cm.vars) {\n                if (var.isEnum) {","sourceCodeStart":156,"sourceCodeEnd":192,"githubUrl":"https://github.com/OpenAPITools/openapi-generator/blob/fcec517be3cf5b7964296bcba25fbc97541484e7/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaLagomServerCodegen.java#L156-L192","documentation":"The scala-lagom-server-deprecated generator overrides toOperationId() and rejects an empty or null operationId with RuntimeException. openapi-generator normally derives an operationId from method+path when the spec omits one, so this is hit when the spec supplies an explicitly empty operationId (or tooling passes one through as empty).","triggerScenarios":"-g scala-lagom-server-deprecated against a spec containing operationId: '' (or a template/null that serializes to empty) on an operation. The check runs per operation during model/operation processing, before files are written.","commonSituations":"Specs post-processed by scripts that blank out operationIds for dedup; YAML where operationId is present but empty; merging specs where the field was dropped. The generator itself is deprecated, so this mostly appears in legacy pipelines.","solutions":["Give every operation a non-empty operationId in the spec","Remove the empty operationId field entirely so the generator derives one from method+path","Prefer a spec linter (e.g. Spectral rule operation-operationId) in CI to catch empty operationIds before generation","Migrate off the deprecated Lagom generator if possible"],"exampleFix":"# before\npaths:\n  /pets:\n    get:\n      operationId: ''\n# after\npaths:\n  /pets:\n    get:\n      operationId: listPets","handlingStrategy":"validation","validationCode":"# Lint every operation for a non-empty operationId (Python):\nfor path, item in spec['paths'].items():\n    for method, op in item.items():\n        if method in {'get','put','post','delete','options','head','patch','trace'}:\n            oid = op.get('operationId')\n            assert oid and oid.strip(), f'{method.upper()} {path} has an empty operationId'","typeGuard":null,"tryCatchPattern":"try {\n    new DefaultGenerator().opts(input).generate();\n} catch (RuntimeException e) {\n    // 'Empty method name (operationId) not allowed' - fill in or delete the empty operationId key, then rerun\n}","preventionTips":["Run a spec linter (Spectral operation-operationId) in CI before generation","Prefer deleting an unused operationId over leaving it empty so the generator derives one","Script-generated specs should omit the key, not serialize it as an empty string"],"tags":["scala","lagom","codegen","operationid","spec-validation","openapi-generator"],"backgroundTag":"invalid-operation-id","analyzedSha":"fcec517be3cf5b7964296bcba25fbc97541484e7","analyzedAt":"2026-08-22T11:13:11.613Z","schemaVersion":2},"datasetVersion":"2026-08-22T14:17:55.899Z"}