{"record":{"id":"eef9a49cf17e3ff4","repo":"alibaba/nacos","slug":"parameter-missing-eef9a4","errorCode":"PARAMETER_MISSING","errorMessage":"Required parameter 'serviceName' type String is not present","messagePattern":"Required parameter 'serviceName' type String is not present","errorType":"validation","errorClass":"NacosApiException","httpStatus":400,"severity":"error","filePath":"naming/src/main/java/com/alibaba/nacos/naming/model/form/ServiceForm.java","lineNumber":58,"sourceCode":"    \n    private String groupName;\n    \n    private Boolean ephemeral;\n    \n    private Float protectThreshold;\n    \n    private String metadata;\n    \n    private String selector;\n    \n    public ServiceForm() {\n    }\n    \n    @Override\n    public void validate() throws NacosApiException {\n        fillDefaultValue();\n        if (StringUtils.isBlank(serviceName)) {\n            throw new NacosApiException(HttpStatus.BAD_REQUEST.value(), ErrorCode.PARAMETER_MISSING,\n                \"Required parameter 'serviceName' type String is not present\");\n        }\n    }\n    \n    /**\n     * fill default value.\n     */\n    public void fillDefaultValue() {\n        if (StringUtils.isBlank(namespaceId)) {\n            namespaceId = Constants.DEFAULT_NAMESPACE_ID;\n        }\n        if (StringUtils.isBlank(groupName)) {\n            groupName = Constants.DEFAULT_GROUP;\n        }\n        if (ephemeral == null) {\n            ephemeral = false;\n        }\n        if (protectThreshold == null) {","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/naming/src/main/java/com/alibaba/nacos/naming/model/form/ServiceForm.java#L40-L76","documentation":"Thrown by ServiceForm.validate() when a service create/update REST request omits or leaves blank the 'serviceName' parameter. Nacos needs serviceName to identify the target service, so the controller rejects the request with HTTP 400 (ErrorCode.PARAMETER_MISSING) before any business logic runs. It is a pure client-side input-validation error.","triggerScenarios":"POST/PUT to the service management endpoint (e.g. /v3/admin/ns/service or legacy /nacos/v1/ns/service) where the query/form body has an empty, blank, or missing 'serviceName' field. The controller binds the form and calls validate(); fillDefaultValue() runs first but only defaults namespaceId/groupName, never serviceName.","commonSituations":"Frontend service form submitted with an empty name field; a maintainer-client or curl command that dropped the serviceName flag; a parameter renamed by mistake (e.g. 'name' instead of 'serviceName'); an SDK call where serviceName was never set.","solutions":["Supply a non-blank 'serviceName' value in the request query string or form body.","If building the request programmatically, assert org.apache.commons.lang3.StringUtils.isNotBlank(serviceName) before sending.","Confirm the field name matches exactly ('serviceName'); some clients send 'serviceName' vs 'name'."],"exampleFix":"// before\ncurl -X POST 'http://host:8848/nacos/v1/ns/service' -d 'groupName=DEFAULT_GROUP'\n// after\ncurl -X POST 'http://host:8848/nacos/v1/ns/service' -d 'serviceName=my-service&groupName=DEFAULT_GROUP'","handlingStrategy":"validation","validationCode":"if (StringUtils.isBlank(serviceName)) {\n    throw new IllegalArgumentException(\"serviceName must not be blank\");\n}\nServiceForm form = new ServiceForm();\nform.setServiceName(serviceName);","typeGuard":"static boolean hasValidServiceName(String s) {\n    return s != null && !s.trim().isEmpty();\n}","tryCatchPattern":null,"preventionTips":["Always populate serviceName from a non-null source before constructing the form.","Add a unit test that asserts validate() passes for a minimal valid form.","Log the full form fields client-side before sending to surface missing params early."],"tags":["naming","rest-api","validation","parameter-missing","service"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}