{"record":{"id":"52ba95a29518dace","repo":"alibaba/nacos","slug":"parameter-missing-52ba95","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/UpdateClusterForm.java","lineNumber":54,"sourceCode":"    \n    private String groupName;\n    \n    private String serviceName;\n    \n    private String clusterName;\n    \n    private Integer checkPort;\n    \n    private Boolean useInstancePort4Check;\n    \n    private String healthChecker;\n    \n    private String metadata;\n    \n    @Override\n    public void validate() throws NacosApiException {\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        if (StringUtils.isBlank(clusterName)) {\n            throw new NacosApiException(HttpStatus.BAD_REQUEST.value(), ErrorCode.PARAMETER_MISSING,\n                \"Required parameter 'clusterName' type String is not present\");\n        }\n        if (null == checkPort) {\n            throw new NacosApiException(HttpStatus.BAD_REQUEST.value(), ErrorCode.PARAMETER_MISSING,\n                \"Required parameter 'checkPort' type Integer is not present\");\n        }\n        if (null == useInstancePort4Check) {\n            throw new NacosApiException(HttpStatus.BAD_REQUEST.value(), ErrorCode.PARAMETER_MISSING,\n                \"Required parameter 'useInstancePort4Check' type Boolean is not present\");\n        }\n        if (StringUtils.isEmpty(healthChecker)) {\n            throw new NacosApiException(HttpStatus.BAD_REQUEST.value(), ErrorCode.PARAMETER_MISSING,\n                \"Required parameter 'healthChecker' type String is not present\");\n        }","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/naming/src/main/java/com/alibaba/nacos/naming/model/form/UpdateClusterForm.java#L36-L72","documentation":"Thrown by UpdateClusterForm.validate() when an update-cluster REST request is missing the 'serviceName' parameter. Updating a cluster's health-check configuration requires the owning service to be named, so validate() rejects the call early with HTTP 400 PARAMETER_MISSING. serviceName is the first of several required fields checked in order.","triggerScenarios":"PUT/POST to the cluster update endpoint (e.g. /v3/admin/ns/cluster or legacy /nacos/v1/ns/cluster) where 'serviceName' is absent or blank while other fields (clusterName, checkPort, etc.) may be present.","commonSituations":"Calling the cluster-update API after copying a template that omitted serviceName; UI passing only clusterName because the service selector was not bound; scripted bulk cluster updates that forgot the service column.","solutions":["Include a non-blank 'serviceName' in the request matching an existing service.","Validate all required fields (serviceName, clusterName, checkPort, useInstancePort4Check, healthChecker) client-side before calling the endpoint.","Check that the service exists in the given namespaceId/groupName first via a service-detail query."],"exampleFix":"// before\nUpdateClusterForm form = new UpdateClusterForm();\nform.setClusterName(\"DEFAULT\");\n// after\nform.setServiceName(\"my-service\");\nform.setClusterName(\"DEFAULT\");","handlingStrategy":"validation","validationCode":"if (StringUtils.isAnyBlank(serviceName, clusterName)) {\n    throw new IllegalArgumentException(\"serviceName and clusterName required\");\n}\nUpdateClusterForm form = new UpdateClusterForm();\nform.setServiceName(serviceName);\nform.setClusterName(clusterName);\nform.setCheckPort(checkPort);\nform.setUseInstancePort4Check(useInstancePort4Check);\nform.setHealthChecker(healthCheckerJson);","typeGuard":"static boolean hasClusterUpdateIdentity(String svc, String cluster) {\n    return StringUtils.isNotBlank(svc) && StringUtils.isNotBlank(cluster);\n}","tryCatchPattern":null,"preventionTips":["Pre-fill all five required fields in one place before calling the endpoint.","Keep a reusable builder/helper that enforces the required-field contract.","Query the service first to confirm it exists before updating its cluster."],"tags":["naming","rest-api","validation","parameter-missing","cluster"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}