{"record":{"id":"62582a5e61db49ab","repo":"alibaba/nacos","slug":"parameter-missing-62582a","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/InstanceMetadataBatchOperationForm.java","lineNumber":60,"sourceCode":"    \n    private String consistencyType;\n    \n    private String instances;\n    \n    private String metadata;\n    \n    public InstanceMetadataBatchOperationForm() {\n    }\n    \n    /**\n     * check param.\n     *\n     * @throws NacosApiException NacosApiException\n     */\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        if (StringUtils.isBlank(metadata)) {\n            throw new NacosApiException(HttpStatus.BAD_REQUEST.value(), ErrorCode.PARAMETER_MISSING,\n                \"Required parameter 'metadata' 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        }","sourceCodeStart":42,"sourceCodeEnd":78,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/naming/src/main/java/com/alibaba/nacos/naming/model/form/InstanceMetadataBatchOperationForm.java#L42-L78","documentation":"Thrown by InstanceMetadataBatchOperationForm.validate() when the 'serviceName' field is blank. This form backs batch instance metadata operations (add/update/delete metadata for multiple instances). The error carries ErrorCode.PARAMETER_MISSING with HTTP 400.","triggerScenarios":"Calling a batch metadata operation API without serviceName, or with serviceName='' / whitespace.","commonSituations":"Client SDK not setting serviceName in a batch metadata request, or a script omitting it.","solutions":["Provide a non-blank serviceName parameter.","Ensure the SDK or request includes serviceName for batch metadata calls."],"exampleFix":"// before\nPUT /v3/admin/ns/instance/metadata/batch?metadata={\"env\":\"prod\"}\n// after\nPUT /v3/admin/ns/instance/metadata/batch?serviceName=my-service&metadata={\"env\":\"prod\"}","handlingStrategy":"validation","validationCode":"if (StringUtils.isBlank(serviceName)) {\n    throw new IllegalArgumentException(\"serviceName is required for batch metadata operations\");\n}","typeGuard":"function hasBatchServiceName(form: { serviceName?: string }): boolean {\n  return typeof form.serviceName === 'string' && form.serviceName.trim().length > 0;\n}","tryCatchPattern":"// Validate before API call\nif (!form.serviceName?.trim()) {\n  throw new Error('serviceName is required for batch metadata operation');\n}","preventionTips":["Populate serviceName when performing batch metadata operations.","Add a client-side pre-flight check."],"tags":["naming","validation","parameter-missing","instance","metadata"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}