alibaba/nacos · error · NacosApiException

PARAMETER_MISSING

PARAMETER_MISSING

Error message

Required parameter 'serviceName' type String is not present

What it means

Thrown by ClientServiceForm.validate() when the 'serviceName' field is blank (null, empty, or whitespace-only). This form backs client-facing service query APIs. The error carries ErrorCode.PARAMETER_MISSING with HTTP 400.

Source

Thrown at naming/src/main/java/com/alibaba/nacos/naming/model/form/ClientServiceForm.java:52

    
    @Serial
    private static final long serialVersionUID = 7382718107541271520L;
    
    private String namespaceId;
    
    private String groupName;
    
    private String serviceName;
    
    private String ip;
    
    private Integer port;
    
    @Override
    public void validate() throws NacosApiException {
        fillDefaultValue();
        if (StringUtils.isBlank(serviceName)) {
            throw new NacosApiException(HttpStatus.BAD_REQUEST.value(), ErrorCode.PARAMETER_MISSING,
                "Required parameter 'serviceName' type String is not present");
        }
    }
    
    /**
     * fill default value.
     */
    public void fillDefaultValue() {
        if (StringUtils.isBlank(namespaceId)) {
            namespaceId = Constants.DEFAULT_NAMESPACE_ID;
        }
        if (StringUtils.isBlank(groupName)) {
            groupName = Constants.DEFAULT_GROUP;
        }
    }
    
    public String getNamespaceId() {
        return namespaceId;

View on GitHub (pinned to 9b989acdf1)

Solutions

  1. Provide a non-blank serviceName in the request.
  2. Ensure the client SDK sets serviceName before calling the API.

Example fix

// before
GET /v3/client/ns/service?namespaceId=public&groupName=DEFAULT_GROUP
// after
GET /v3/client/ns/service?namespaceId=public&groupName=DEFAULT_GROUP&serviceName=my-service
Defensive patterns

Strategy: validation

Validate before calling

if (StringUtils.isBlank(serviceName)) {
    throw new IllegalArgumentException("serviceName is required");
}

Type guard

function hasServiceName(form: { serviceName?: string }): boolean {
  return typeof form.serviceName === 'string' && form.serviceName.trim().length > 0;
}

Try / catch

// HTTP 400 — validate on the client side before sending
if (!hasServiceName(form)) {
  return Promise.reject(new Error('serviceName is required'));
}

Prevention

When it happens

Trigger: Calling a client-facing naming API (e.g. GET /v3/client/ns/service) without providing the serviceName query parameter, or passing serviceName='' or serviceName=' '.

Common situations: Forgetting the serviceName parameter in the request URL, or a client SDK not populating it before the call.

Related errors


AI-assisted analysis of alibaba/nacos@9b989acdf1 (2026-08-14). Data as JSON: /api/errors/2a0ebecf4c4a62ec. Report an issue: GitHub.