alibaba/nacos · error · IllegalArgumentException
dataId={dataId}, group={group}
Error message
dataId={dataId}, group={group} What it means
Thrown by the CacheData constructor when dataId or group is null. CacheData is the in-memory representation of a single config identified by (dataId, group, tenant); a null dataId or group makes the resource unaddressable and would break cache maps keyed on these fields. The constructor rejects either being null (note: empty strings are NOT rejected here, only nulls).
Source
Thrown at client/src/main/java/com/alibaba/nacos/client/config/impl/CacheData.java:586
public boolean isDiscard() {
return isDiscard;
}
public void setDiscard(boolean discard) {
isDiscard = discard;
}
public CacheData(ConfigFilterChainManager configFilterChainManager, String envName,
String dataId, String group) {
this(configFilterChainManager, envName, dataId, group, TenantUtil.getUserTenantForAcm());
}
public CacheData(ConfigFilterChainManager configFilterChainManager, String envName,
String dataId, String group,
String tenant) {
if (null == dataId || null == group) {
throw new IllegalArgumentException("dataId=" + dataId + ", group=" + group);
}
this.configFilterChainManager = configFilterChainManager;
this.envName = envName;
this.dataId = dataId;
this.group = group;
this.tenant = tenant;
this.listeners = new CopyOnWriteArrayList<>();
this.isInitializing = true;
if (initSnapshot) {
this.content = loadCacheContentFromDiskLocal(envName, dataId, group, tenant);
this.encryptedDataKey =
loadEncryptedDataKeyFromDiskLocal(envName, dataId, group, tenant);
this.md5 = getMd5String(this.content);
}
}
// ==================
View on GitHub (pinned to 9b989acdf1)
Solutions
- Validate dataId and group are non-null before constructing CacheData (use ParamUtils.isValid).
- Trace which caller builds CacheData with null fields (often LocalConfigInfoProcessor or ClientWorker) and fix the upstream parse.
- Delete corrupted snapshot files that yield null dataId/group on reload.
Example fix
// before
CacheData cd = new CacheData(filter, env, dataId, group, tenant);
// after
if (dataId == null || group == null) {
throw new IllegalArgumentException("dataId and group must not be null");
}
CacheData cd = new CacheData(filter, env, dataId, group, tenant); Defensive patterns
Strategy: validation
Validate before calling
if (dataId == null || group == null) {
throw new IllegalArgumentException("dataId and group must not be null");
}
new CacheData(filter, env, dataId, group, tenant); Type guard
static boolean hasNonNullKeys(String dataId, String group) {
return dataId != null && group != null;
} Try / catch
try {
new CacheData(filter, env, dataId, group, tenant);
} catch (IllegalArgumentException e) {
if (e.getMessage().startsWith("dataId=")) {
log.error("null dataId or group constructing CacheData", e);
}
} Prevention
- Validate dataId/group non-null before constructing CacheData.
- Sanitize snapshots that parse to null fields.
- Use ParamUtils.isValid for full validation.
When it happens
Trigger: Constructing new CacheData(...) with a null dataId or group argument, typically indirectly via internal client code that failed to resolve the dataId/group from a request or snapshot.
Common situations: A malformed config request, a snapshot/failover file whose parsed dataId/group is null, or internal client logic invoking the constructor before validating inputs.
Related errors
- listener is null
- 10000
- PARAMETER_MISSING
- Base directory cannot be blank
- [NACOS HTTP-GET] The maximum number of tolerable server reco
AI-assisted analysis of alibaba/nacos@9b989acdf1 (2026-08-14).
Data as JSON: /api/errors/f7e2a24a20bf47fb.
Report an issue: GitHub.