{"record":{"id":"139d5f8b45b6f9d5","repo":"OpenAPITools/openapi-generator","slug":"please-report-the-issue-as-the-parameter-name-cann","errorCode":null,"errorMessage":"Please report the issue as the parameter name cannot be null: %s","messagePattern":"Please report the issue as the parameter name cannot be null: (.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPythonConnexionServerCodegen.java","lineNumber":410,"sourceCode":"                            tag = operation.getTags().get(0);\n                        }\n                        String operationId = getOrGenerateOperationId(operation, pathname, method.toString());\n                        operation.setOperationId(toOperationId(operationId));\n                        if (operation.getExtensions() == null || operation.getExtensions().get(\"x-openapi-router-controller\") == null) {\n                            operation.addExtension(\n                                    \"x-openapi-router-controller\",\n                                    controllerPackage + \".\" + toApiFilename(tag)\n                            );\n                        }\n                        if (operation.getParameters() != null) {\n                            for (Parameter parameter : operation.getParameters()) {\n                                if (StringUtils.isNotEmpty(parameter.get$ref())) {\n                                    parameter = ModelUtils.getReferencedParameter(openAPI, parameter);\n                                }\n                                String swaggerParameterName = parameter.getName();\n                                String pythonParameterName = this.toParamName(swaggerParameterName);\n                                if (swaggerParameterName == null) {\n                                    throw new RuntimeException(\"Please report the issue as the parameter name cannot be null: \" + parameter);\n                                }\n                                if (!swaggerParameterName.equals(pythonParameterName)) {\n                                    LOGGER.warn(\n                                            \"Parameter name '{}' is not consistent with Python variable names. It will be replaced by '{}'\",\n                                            swaggerParameterName, pythonParameterName);\n                                    parameter.addExtension(\"x-python-connexion-openapi-name\", swaggerParameterName);\n                                    parameter.setName(pythonParameterName);\n                                }\n                                if (swaggerParameterName.isEmpty()) {\n                                    LOGGER.error(\"Missing parameter name in {}.{}\", pathname, parameter.getIn());\n                                }\n                            }\n                        }\n                        RequestBody body = operation.getRequestBody();\n                        if (fixBodyName && body != null) {\n                            if (body.getExtensions() == null || !body.getExtensions().containsKey(\"x-body-name\")) {\n                                String bodyParameterName = \"body\";\n                                if (operation.getExtensions() != null && operation.getExtensions().containsKey(\"x-codegen-request-body-name\")) {","sourceCodeStart":392,"sourceCodeEnd":428,"githubUrl":"https://github.com/OpenAPITools/openapi-generator/blob/fcec517be3cf5b7964296bcba25fbc97541484e7/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPythonConnexionServerCodegen.java#L392-L428","documentation":"AbstractPythonConnexionServerCodegen renames spec parameters that are not valid Python identifiers. After dereferencing $refs it reads parameter.getName(); if the name is null it throws RuntimeException('Please report the issue as the parameter name cannot be null'). A null name means the spec (or the resolved $ref target) supplied a parameter object with no 'name' key — the generator assumes one exists on every parameter object.","triggerScenarios":"A parameter object missing the required 'name' field, e.g. { in: query, schema: { type: string } }, or a $ref pointing at a component that lacks name. An empty-string name only logs an error later, it does not throw; null is what raises this. Note this.toParamName is called before the null check, so some builds NPE first — same root cause.","commonSituations":"Hand-written specs; exporters/refactoring tools that drop 'name'; specs that slip past lenient 3.1 parsing; operations generated from templates with unfilled name fields.","solutions":["Add an explicit name to every parameter in the failing operation (the surrounding loop's pathname identifies the path item)","Validate with a strict linter (Spectral oas3 rules, swagger-cli validate) and fix every 'parameter must have a name' error before generating","If the spec validates clean and it still throws, upgrade openapi-generator and report the issue with the operation"],"exampleFix":"# before\nparameters:\n  - in: query\n    schema:\n      type: string\n\n# after\nparameters:\n  - name: q\n    in: query\n    schema:\n      type: string","handlingStrategy":"validation","validationCode":"// JS: every parameter object (incl. resolved refs) must have a non-null name\nconst components = (spec.components && spec.components.parameters) || {};\nfunction hasName(p) { return p && p.name != null; }\nfor (const item of Object.values(spec.paths || {})) {\n  for (const op of Object.values(item)) {\n    for (const p of (op && op.parameters) || []) {\n      const resolved = p.$ref ? components[p.$ref.split('/').pop()] : p;\n      if (!hasName(resolved)) fail('parameter without name');\n    }\n  }\n}","typeGuard":null,"tryCatchPattern":"try { generator.generate(); } catch (RuntimeException e) { if (String.valueOf(e.getMessage()).contains(\"parameter name cannot be null\")) { /* find the parameter missing 'name' in the printed operation */ } throw e; }","preventionTips":["Always run a strict validator (swagger-cli validate) before connexion generation","Never hand-write a parameter without its name/in/schema triple","Check $ref targets in components/parameters still define name after edits"],"tags":["connexion","python","parameters","openapi-spec"],"backgroundTag":"missing-parameter-name","analyzedSha":"fcec517be3cf5b7964296bcba25fbc97541484e7","analyzedAt":"2026-08-22T11:13:11.613Z","schemaVersion":2},"datasetVersion":"2026-08-22T14:17:55.899Z"}