{"record":{"id":"8e69ae9bfa232cda","repo":"OpenAPITools/openapi-generator","slug":"empty-method-name-operationid-not-allowed-8e69ae","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/ScalazClientCodegen.java","lineNumber":214,"sourceCode":"    public CodegenType getTag() {\n        return CodegenType.CLIENT;\n    }\n\n    @Override\n    public String getName() {\n        return \"scalaz\";\n    }\n\n    @Override\n    public String getHelp() {\n        return \"Generates a Scalaz client library (beta) that uses http4s\";\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    private static abstract class CustomLambda implements Mustache.Lambda {\n        @Override\n        public void execute(Template.Fragment frag, Writer out) throws IOException {\n            final StringWriter tempWriter = new StringWriter();\n            frag.execute(tempWriter);\n            out.write(formatFragment(tempWriter.toString()));\n        }\n","sourceCodeStart":196,"sourceCodeEnd":232,"githubUrl":"https://github.com/OpenAPITools/openapi-generator/blob/fcec517be3cf5b7964296bcba25fbc97541484e7/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalazClientCodegen.java#L196-L232","documentation":"The scalaz (beta, http4s-based) client generator overrides toOperationId() identically to the Lagom generator: an empty or null operationId throws RuntimeException('Empty method name (operationId) not allowed'). openapi-generator usually synthesizes an id from method+path, so this fires on explicitly empty values passed through the spec.","triggerScenarios":"-g scalaz with a spec whose operation has operationId: '' or a null/blank value that reaches the generator unmodified.","commonSituations":"Machine-generated specs that emit an empty operationId key instead of omitting it; spec transformations that strip ids for deduplication then fail to refill them; legacy pipelines still using the beta scalaz generator.","solutions":["Set a meaningful non-empty operationId on every operation","Delete the empty operationId key so the generator derives one from the path and method","Validate the spec (Spectral operation-operationId or a pre-flight script) before invoking generation in CI"],"exampleFix":"# before\npaths:\n  /users/{id}:\n    get:\n      operationId: ''\n# after\npaths:\n  /users/{id}:\n    get:\n      operationId: getUser","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' - set or delete the operationId, then regenerate\n}","preventionTips":["Validate operationIds with a linter before scalaz generation","Omit the key rather than emitting operationId: ''","Consider migrating off the beta scalaz generator to a maintained Scala client"],"tags":["scala","scalaz","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"}