{"record":{"id":"98a92278e0b3b540","repo":"alibaba/nacos","slug":"parameter-missing-98a922","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/InstanceForm.java","lineNumber":71,"sourceCode":"    \n    private Boolean enabled;\n    \n    private String metadata;\n    \n    private Boolean ephemeral;\n    \n    public InstanceForm() {\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(ip)) {\n            throw new NacosApiException(HttpStatus.BAD_REQUEST.value(), ErrorCode.PARAMETER_MISSING,\n                \"Required parameter 'ip' type String is not present\");\n        }\n        if (port == null) {\n            throw new NacosApiException(HttpStatus.BAD_REQUEST.value(), ErrorCode.PARAMETER_MISSING,\n                \"Required parameter 'port' type Integer 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;","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/naming/src/main/java/com/alibaba/nacos/naming/model/form/InstanceForm.java#L53-L89","documentation":"Thrown by InstanceForm.validate() when the 'serviceName' field is blank. This form backs instance registration/query/update APIs. The error carries ErrorCode.PARAMETER_MISSING with HTTP 400.","triggerScenarios":"Calling an instance API (e.g. POST /v3/client/ns/instance) without serviceName, or with serviceName='' / whitespace.","commonSituations":"Client SDK not setting serviceName, or a curl/script omitting the parameter.","solutions":["Provide a non-blank serviceName parameter.","Verify the SDK or HTTP client includes serviceName in the request."],"exampleFix":"// before\nPOST /v3/client/ns/instance?ip=10.0.0.1&port=8080\n// after\nPOST /v3/client/ns/instance?serviceName=my-service&ip=10.0.0.1&port=8080","handlingStrategy":"validation","validationCode":"if (StringUtils.isBlank(serviceName)) {\n    throw new IllegalArgumentException(\"serviceName is required for instance operations\");\n}","typeGuard":"function hasInstanceServiceName(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');\n}","preventionTips":["Ensure the SDK auto-populates serviceName from the service registration context.","Validate required fields before constructing the HTTP request."],"tags":["naming","validation","parameter-missing","instance"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}