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

  1. Provide all three values, e.g. ("zk.prod:2181", "Sentinel_Group", "my-app-flow-rules", parser).
  2. Confirm the composed path (groupId/dataId per getPath()) matches where rules actually live in ZooKeeper.
  3. 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

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


AI-assisted analysis of alibaba/Sentinel@a3f40ba8e9 (2026-08-14). Data as JSON: /api/errors/218bee51b604c87a. Report an issue: GitHub.