alibaba/nacos · error · IllegalArgumentException

Param 'groupName' is illegal, groupName is blank

Error message

Param 'groupName' is illegal, groupName is blank

What it means

Sibling check to 542: getGroupedName also requires a non-blank groupName. Even with a valid serviceName, a blank groupName makes the composite key invalid because the group segment is mandatory in Nacos naming.

Source

Thrown at api/src/main/java/com/alibaba/nacos/api/naming/utils/NamingUtils.java:67

     * Returns a combined string with serviceName and groupName. serviceName can not be nil.
     *
     * <p>In most cases, serviceName can not be nil. In other cases, for search or anything, See {@link
     * com.alibaba.nacos.api.naming.utils.NamingUtils#getGroupedNameOptional(String, String)}
     *
     * <p>etc:
     * <p>serviceName | groupName | result</p>
     * <p>serviceA    | groupA    | groupA@@serviceA</p>
     * <p>nil         | groupA    | threw IllegalArgumentException</p>
     *
     * @return 'groupName@@serviceName'
     */
    public static String getGroupedName(final String serviceName, final String groupName) {
        if (StringUtils.isBlank(serviceName)) {
            throw new IllegalArgumentException(
                "Param 'serviceName' is illegal, serviceName is blank");
        }
        if (StringUtils.isBlank(groupName)) {
            throw new IllegalArgumentException("Param 'groupName' is illegal, groupName is blank");
        }
        final String resultGroupedName = groupName + Constants.SERVICE_INFO_SPLITER + serviceName;
        return resultGroupedName.intern();
    }
    
    public static String getServiceKey(String namespace, String group, String serviceName) {
        if (StringUtils.isBlank(namespace)) {
            namespace = DEFAULT_NAMESPACE_ID;
        }
        return namespace + Constants.SERVICE_INFO_SPLITER + group + Constants.SERVICE_INFO_SPLITER
            + serviceName;
    }
    
    /**
     * parse service key items for serviceKey. item[0] for namespace item[1] for group item[2] for service name
     *
     * @param serviceKey serviceKey.
     * @return

View on GitHub (pinned to 9b989acdf1)

Solutions

  1. Provide a non-blank groupName (e.g. Constants.DEFAULT_GROUP).
  2. Default missing group to DEFAULT_GROUP before calling getGroupedName.

Example fix

// before
String key = NamingUtils.getGroupedName("svc", "");  // throws 543

// after
String group = StringUtils.isBlank(groupName) ? Constants.DEFAULT_GROUP : groupName;
String key = NamingUtils.getGroupedName("svc", group);
Defensive patterns

Strategy: validation

Validate before calling

String group = StringUtils.isBlank(groupName) ? Constants.DEFAULT_GROUP : groupName;
NamingUtils.getGroupedName(serviceName, group);

Prevention

When it happens

Trigger: Calling getGroupedName(serviceName, "") or with a null/whitespace groupName; defaulting groupName to empty when no group was configured.

Common situations: Client omitted the group argument expecting a default; misconfigured default group constant resolving to blank.

Related errors


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