alibaba/Sentinel · error · IllegalArgumentException
Bad argument: serverAddr=[%s], groupId=[%s], dataId=[%s]
Error message
Bad argument: serverAddr=[%s], groupId=[%s], dataId=[%s]
What it means
Thrown by the Nacos-style ZookeeperDataSource constructor when serverAddr, groupId, or dataId is blank. This overload composes the znode path from groupId and dataId (via getPath(groupId, dataId)) instead of taking an explicit path, so all three identifiers must be present.
Source
Thrown at sentinel-extension/sentinel-datasource-zookeeper/src/main/java/com/alibaba/csp/sentinel/datasource/zookeeper/ZookeeperDataSource.java:66
public ZookeeperDataSource(final String serverAddr, final String path, Converter<String, T> parser) {
super(parser);
if (StringUtil.isBlank(serverAddr) || StringUtil.isBlank(path)) {
throw new IllegalArgumentException(String.format("Bad argument: serverAddr=[%s], path=[%s]", serverAddr, path));
}
this.path = path;
init(serverAddr, null);
}
/**
* This constructor is Nacos-style.
*/
public ZookeeperDataSource(final String serverAddr, final String groupId, final String dataId,
Converter<String, T> parser) {
super(parser);
if (StringUtil.isBlank(serverAddr) || StringUtil.isBlank(groupId) || StringUtil.isBlank(dataId)) {
throw new IllegalArgumentException(String.format("Bad argument: serverAddr=[%s], groupId=[%s], dataId=[%s]", serverAddr, groupId, dataId));
}
this.path = getPath(groupId, dataId);
init(serverAddr, null);
}
/**
* This constructor adds authentication information.
*/
public ZookeeperDataSource(final String serverAddr, final List<AuthInfo> authInfos, final String groupId, final String dataId,
Converter<String, T> parser) {
super(parser);
if (StringUtil.isBlank(serverAddr) || StringUtil.isBlank(groupId) || StringUtil.isBlank(dataId)) {
throw new IllegalArgumentException(String.format("Bad argument: serverAddr=[%s], authInfos=[%s], groupId=[%s], dataId=[%s]", serverAddr, authInfos, groupId, dataId));
}
this.path = getPath(groupId, dataId);
init(serverAddr, authInfos);View on GitHub (pinned to a3f40ba8e9)
Solutions
- Provide all three values, e.g. ("zk.prod:2181", "Sentinel_Group", "my-app-flow-rules", parser).
- Confirm the composed path (groupId/dataId per getPath()) matches where rules actually live in ZooKeeper.
- Add a startup assertion on the three properties so a blank one fails with its name.
Example fix
// before
new ZookeeperDataSource<>(zkAddr, "", "my-app-flow-rules", parser);
// after
new ZookeeperDataSource<>("zk.prod:2181", "Sentinel_Group", "my-app-flow-rules", parser); Defensive patterns
Strategy: validation
Validate before calling
if (StringUtil.isBlank(serverAddr) || StringUtil.isBlank(groupId) || StringUtil.isBlank(dataId)) {
throw new IllegalArgumentException("zookeeper serverAddr/groupId/dataId required");
}
new ZookeeperDataSource<>(serverAddr, groupId, dataId, parser); Try / catch
try {
new ZookeeperDataSource<>(serverAddr, groupId, dataId, parser);
} catch (IllegalArgumentException e) {
throw new IllegalStateException("ZooKeeper datasource misconfigured: " + serverAddr + "/" + groupId + "/" + dataId, e);
} Prevention
- Ensure groupId/dataId compose to the znode path that actually holds the rules.
- Define these keys in a base profile so no environment starts without them.
When it happens
Trigger: new ZookeeperDataSource(serverAddr, groupId, dataId, parser) where any argument is null/empty/whitespace — most often an unresolved placeholder or a property key defined in a different profile.
Common situations: Reusing Nacos config keys for ZooKeeper but the group/dataId properties are absent; placeholder substitution failing; whitespace-only values from YAML indentation mistakes.
Related errors
- Bad argument: serverAddr=[%s], path=[%s]
- Bad argument: serverAddr=[%s], authInfos=[%s], groupId=[%s],
- File can't be null or a directory
- charset can't be null
- Bad file
AI-assisted analysis of alibaba/Sentinel@a3f40ba8e9 (2026-08-14).
Data as JSON: /api/errors/218bee51b604c87a.
Report an issue: GitHub.