{"record":{"id":"da665030c0dadd11","repo":"OpenAPITools/openapi-generator","slug":"empty-method-name-operationid-not-allowed-da6650","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/AbstractPythonPydanticV1Codegen.java","lineNumber":278,"sourceCode":"        // obtain the name from parameterNameMapping directly if provided\n        if (parameterNameMapping.containsKey(name)) {\n            return parameterNameMapping.get(name);\n        }\n\n        // to avoid conflicts with 'callback' parameter for async call\n        if (\"callback\".equals(name)) {\n            return \"param_callback\";\n        }\n\n        // use variable-name normalization without model property mappings\n        return toVarNameWithoutNameMapping(name);\n    }\n\n    @Override\n    public String toOperationId(String operationId) {\n        // throw exception if method name is empty (should not occur as an auto-generated method name will be used)\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            LOGGER.warn(\"{} (reserved word) cannot be used as method name. Renamed to {}\", operationId, underscore(sanitizeName(\"call_\" + operationId)));\n            operationId = \"call_\" + operationId;\n        }\n\n        // operationId starts with a number\n        if (operationId.matches(\"^\\\\d.*\")) {\n            LOGGER.warn(\"{} (starting with a number) cannot be used as method name. Renamed to {}\", operationId, underscore(sanitizeName(\"call_\" + operationId)));\n            operationId = \"call_\" + operationId;\n        }\n\n        return underscore(sanitizeName(operationId));\n    }\n\n    @Override","sourceCodeStart":260,"sourceCodeEnd":296,"githubUrl":"https://github.com/OpenAPITools/openapi-generator/blob/fcec517be3cf5b7964296bcba25fbc97541484e7/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPythonPydanticV1Codegen.java#L260-L296","documentation":"AbstractPythonPydanticV1Codegen.toOperationId throws RuntimeException when the operationId it receives is empty; the code comment notes this should not occur because the default pipeline auto-generates a method name. Reaching the guard means id synthesis upstream did not happen or produced an empty string.","triggerScenarios":"An operation with operationId: \"\" (explicitly empty) whose summary is absent or sanitizes to empty (e.g. a summary of only punctuation/emoji), or a direct programmatic call to the generator API passing an empty operationId.","commonSituations":"Templated spec pipelines that render operationId from data which can be empty; conversion tools that blank ids; specs whose summaries are non-word characters only.","solutions":["Give every operation a unique non-empty operationId","If relying on auto-generation, keep a summary containing at least some word characters so the synthesized id is non-empty","Delete operationId: \"\" keys entirely so summary/path-based fallback naming applies"],"exampleFix":"# before\nget:\n  operationId: ''\n  summary: '***'\n\n# after\nget:\n  operationId: list_users\n  summary: List users","handlingStrategy":"validation","validationCode":"// JS: flag empty operationIds, and summaries that sanitize to empty\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    if (op.operationId === undefined && !(op.summary || '').match(/[a-z0-9]/i)) fail(`${m} ${p}: no usable summary for id synthesis`);\n  }\n}","typeGuard":null,"tryCatchPattern":"try { generator.generate(); } catch (RuntimeException e) { if (\"Empty method name (operationId) not allowed\".equals(e.getMessage())) { /* set an operationId on the failing operation */ } throw e; }","preventionTips":["Give every operation an explicit operationId in authored specs","When templating specs, fail the build on empty rendered ids","Keep summaries with at least one word character so fallback naming works"],"tags":["pydantic","operationid","openapi-spec","python"],"backgroundTag":"missing-operation-id","analyzedSha":"fcec517be3cf5b7964296bcba25fbc97541484e7","analyzedAt":"2026-08-22T11:13:11.613Z","schemaVersion":2},"datasetVersion":"2026-08-22T14:17:55.899Z"}