{"record":{"id":"c623ada517815152","repo":"OpenAPITools/openapi-generator","slug":"empty-method-operation-name-operationid-not-allo-c623ad","errorCode":null,"errorMessage":"Empty method/operation name (operationId) not allowed","messagePattern":"Empty method/operation name \\(operationId\\) not allowed","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractScalaCodegen.java","lineNumber":591,"sourceCode":"            return;\n        }\n\n        String scalaPostProcessFile = System.getenv(\"SCALA_POST_PROCESS_FILE\");\n        if (StringUtils.isEmpty(scalaPostProcessFile)) {\n            return; // skip if SCALA_POST_PROCESS_FILE env variable is not defined\n        }\n\n        // only process files with scala extension\n        if (\"scala\".equals(FilenameUtils.getExtension(file.toString()))) {\n            this.executePostProcessor(new String[]{scalaPostProcessFile, file.toString()});\n        }\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/operation name (operationId) not allowed\");\n        }\n\n        operationId = camelize(sanitizeName(operationId), LOWERCASE_FIRST_LETTER);\n\n        // method name cannot use reserved keyword, e.g. return\n        if (isReservedWord(operationId)) {\n            String newOperationId = camelize(\"call_\" + operationId, LOWERCASE_FIRST_LETTER);\n            LOGGER.warn(\"{} (reserved word) cannot be used as method name. Renamed to {}\", operationId, newOperationId);\n            return newOperationId;\n        }\n\n        // operationId starts with a number\n        if (operationId.matches(\"^\\\\d.*\")) {\n            LOGGER.warn(operationId + \" (starting with a number) cannot be used as method sname. Renamed to \" + camelize(\"call_\" + operationId), true);\n            operationId = camelize(\"call_\" + operationId, LOWERCASE_FIRST_LETTER);\n        }\n\n        return operationId;","sourceCodeStart":573,"sourceCodeEnd":609,"githubUrl":"https://github.com/OpenAPITools/openapi-generator/blob/fcec517be3cf5b7964296bcba25fbc97541484e7/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractScalaCodegen.java#L573-L609","documentation":"AbstractScalaCodegen.toOperationId throws RuntimeException when the operationId handed to it is empty. The default pipeline normally substitutes a synthesized id (derived from the operation summary, else from method + path) before this point, so an empty id reaching the guard means synthesis was skipped or itself produced nothing usable.","triggerScenarios":"operationId: \"\" explicitly set with no summary, or a summary consisting solely of characters that sanitize away (pure symbols/emoji); also direct programmatic use of the generator API passing an empty operationId. Reserved-word or digit-leading ids do NOT throw — those are renamed via camelize('call_' + ...).","commonSituations":"Templated spec pipelines rendering operationId from data that can be empty; scraping/conversion tools that blank ids; specs whose only summary is decorative characters.","solutions":["Set a unique non-empty operationId on every operation","Delete empty operationId keys so summary/path-based fallback naming applies","If relying on fallback naming, keep a summary with at least some word characters"],"exampleFix":"# before\nget:\n  operationId: ''\n  responses: { '200': { description: ok } }\n\n# after\nget:\n  operationId: list_users\n  responses: { '200': { description: ok } }","handlingStrategy":"validation","validationCode":"// JS: no empty operationIds; usable summary when id absent\nfor (const [p, item] of Object.entries(spec.paths || {})) {\n  for (const [m, op] of Object.entries(item)) {\n    if (!op || !op.responses) continue;\n    if (op.operationId === '') fail(`${m} ${p}: empty operationId`);\n  }\n}","typeGuard":null,"tryCatchPattern":"try { generator.generate(); } catch (RuntimeException e) { if (\"Empty method/operation name (operationId) not allowed\".equals(e.getMessage())) { /* set operationId or a word-bearing summary on the failing operation */ } throw e; }","preventionTips":["Always set explicit operationIds in authored specs","Fail template pipelines on empty rendered ids","Keep summaries that contain at least one word character"],"tags":["scala","operationid","openapi-spec"],"backgroundTag":"missing-operation-id","analyzedSha":"fcec517be3cf5b7964296bcba25fbc97541484e7","analyzedAt":"2026-08-22T11:13:11.613Z","schemaVersion":2},"datasetVersion":"2026-08-22T14:17:55.899Z"}