alibaba/nacos · error · IllegalArgumentException
Can't parse out 'groupName',but it must not be null!
Error message
Can't parse out 'groupName',but it must not be null!
What it means
ServiceInfo(String key) splits a composite key by '@@'. It needs at least GROUP_POSITION and SERVICE_POSITION parts to recover groupName and name. If the split yields fewer parts than CLUSTER_POSITION (defensive branch), it throws IllegalArgumentException because groupName cannot be safely derived.
Source
Thrown at api/src/main/java/com/alibaba/nacos/api/naming/pojo/ServiceInfo.java:102
this.allIps = allIps;
}
/**
* There is only one form of the key:groupName@@name@@clusters. This constructor used by DiskCache.read(String) and
* FailoverReactor.FailoverFileReader,you should know that 'groupName' must not be null,and 'clusters' can be null.
*/
public ServiceInfo(final String key) {
String[] keys = key.split(Constants.SERVICE_INFO_SPLITER);
if (keys.length >= FILE_NAME_PARTS) {
this.groupName = keys[GROUP_POSITION];
this.name = keys[SERVICE_POSITION];
this.clusters = keys[CLUSTER_POSITION];
} else if (keys.length == CLUSTER_POSITION) {
this.groupName = keys[GROUP_POSITION];
this.name = keys[SERVICE_POSITION];
} else {
//defensive programming
throw new IllegalArgumentException(
"Can't parse out 'groupName',but it must not be null!");
}
}
public ServiceInfo(String name, String clusters) {
this.name = name;
this.clusters = clusters;
}
public int ipCount() {
return hosts.size();
}
public boolean expired() {
return System.currentTimeMillis() - lastRefTime > cacheMillis;
}
public void setHosts(List<Instance> hosts) {View on GitHub (pinned to 9b989acdf1)
Solutions
- Pass a key in the form 'group@@name' or 'group@@name@@clusters'.
- Use the ServiceInfo(name, clusters) constructor when you only have a plain name.
- Build keys via NamingUtils.getServiceKey(...) / getGroupedName(...) rather than hand-concatenating.
Example fix
// before
ServiceInfo info = new ServiceInfo("my-service"); // throws 541
// after
ServiceInfo info = new ServiceInfo("DEFAULT_GROUP@@my-service@@DEFAULT"); Defensive patterns
Strategy: validation
Validate before calling
String[] parts = key.split(Constants.SERVICE_INFO_SPLITER);
if (parts.length < 2) {
throw new IllegalArgumentException("key must be at least 'group@@name'");
} Try / catch
try {
return new ServiceInfo(key);
} catch (IllegalArgumentException e) {
// rebuild a valid key from explicit group + name
return new ServiceInfo(NamingUtils.getGroupedName(name, group), clusters);
} Prevention
- Never pass a bare serviceName to ServiceInfo(String).
- Build keys via NamingUtils.getServiceKey / getGroupedName.
- Use ServiceInfo(name, clusters) when you only have a plain name.
When it happens
Trigger: Constructing new ServiceInfo("my-service") with a bare name; reading a corrupted cache filename that lost its '@@' separators; passing a plain serviceName where a grouped key is expected.
Common situations: Service-info cache file rebuilt incorrectly after a version change; client code confusing serviceName with the composite key; manually crafted keys missing the group segment.
Related errors
- Param 'serviceName' is illegal, serviceName is blank
- Param 'groupName' is illegal, groupName is blank
- Param 'serviceName' is illegal, it should be format as 'grou
- Param 'serviceName' is illegal, groupName can't be empty
- 10000
AI-assisted analysis of alibaba/nacos@9b989acdf1 (2026-08-14).
Data as JSON: /api/errors/e16c7eba4effa195.
Report an issue: GitHub.