{"record":{"id":"116361c48bbd9355","repo":"alibaba/Sentinel","slug":"bad-argument-serveraddr-s-path-s","errorCode":null,"errorMessage":"Bad argument: serverAddr=[%s], path=[%s]","messagePattern":"Bad argument: serverAddr=\\[(.+?)\\], path=\\[(.+?)\\]","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sentinel-extension/sentinel-datasource-zookeeper/src/main/java/com/alibaba/csp/sentinel/datasource/zookeeper/ZookeeperDataSource.java","lineNumber":52,"sourceCode":"\n    private static volatile Map<String, CuratorFramework> zkClientMap = new HashMap<>();\n    private static final Object lock = new Object();\n\n\n    private final ExecutorService pool = new ThreadPoolExecutor(1, 1, 0, TimeUnit.MILLISECONDS,\n            new ArrayBlockingQueue<Runnable>(1), new NamedThreadFactory(\"sentinel-zookeeper-ds-update\", true),\n            new ThreadPoolExecutor.DiscardOldestPolicy());\n\n    private CuratorCacheListener listener;\n    private final String path;\n\n    private CuratorFramework zkClient = null;\n    private CuratorCache nodeCache = null;\n\n    public ZookeeperDataSource(final String serverAddr, final String path, Converter<String, T> parser) {\n        super(parser);\n        if (StringUtil.isBlank(serverAddr) || StringUtil.isBlank(path)) {\n            throw new IllegalArgumentException(String.format(\"Bad argument: serverAddr=[%s], path=[%s]\", serverAddr, path));\n        }\n        this.path = path;\n\n        init(serverAddr, null);\n    }\n\n    /**\n     * This constructor is Nacos-style.\n     */\n    public ZookeeperDataSource(final String serverAddr, final String groupId, final String dataId,\n                               Converter<String, T> parser) {\n        super(parser);\n        if (StringUtil.isBlank(serverAddr) || StringUtil.isBlank(groupId) || StringUtil.isBlank(dataId)) {\n            throw new IllegalArgumentException(String.format(\"Bad argument: serverAddr=[%s], groupId=[%s], dataId=[%s]\", serverAddr, groupId, dataId));\n        }\n        this.path = getPath(groupId, dataId);\n\n        init(serverAddr, null);","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/alibaba/Sentinel/blob/a3f40ba8e900c8489bd520274739f17235a7721c/sentinel-extension/sentinel-datasource-zookeeper/src/main/java/com/alibaba/csp/sentinel/datasource/zookeeper/ZookeeperDataSource.java#L34-L70","documentation":"Thrown by the ZookeeperDataSource path-style constructor when serverAddr or path is blank. The constructor subscribes to a single ZooKeeper znode whose full path you supply; blank values make the watch meaningless, so Sentinel rejects them before connecting.","triggerScenarios":"new ZookeeperDataSource(serverAddr, path, parser) with a null/empty serverAddr (e.g. unresolved \"${zk.addr}\" placeholder) or a missing/blank znode path (no leading /zk path to the config node).","commonSituations":"ZooKeeper address property missing in one environment; path key typo so lookup returns null; copy-pasted example with placeholder strings never replaced.","solutions":["Set a valid address like \"127.0.0.1:2181\" and a real znode path like \"/sentinel/rules/my-app\".","Verify the znode exists in ZooKeeper (zkCli.sh: ls /sentinel/rules/my-app) so the watch has something to observe.","Validate both values from your config before construction and fail with the offending property name."],"exampleFix":"// before\nnew ZookeeperDataSource<>(null, \"/sentinel/rules\", parser);\n\n// after\nnew ZookeeperDataSource<>(\"zk.prod:2181\", \"/sentinel/rules/my-app\", parser);","handlingStrategy":"validation","validationCode":"if (StringUtil.isBlank(serverAddr) || StringUtil.isBlank(path)) {\n    throw new IllegalArgumentException(\"zookeeper serverAddr and znode path are required, got: \"\n        + serverAddr + \", \" + path);\n}\nnew ZookeeperDataSource<>(serverAddr, path, parser);","typeGuard":null,"tryCatchPattern":"try {\n    new ZookeeperDataSource<>(serverAddr, path, parser);\n} catch (IllegalArgumentException e) {\n    throw new IllegalStateException(\"ZooKeeper datasource misconfigured: addr=\" + serverAddr + \" path=\" + path, e);\n}","preventionTips":["Verify the znode exists with zkCli.sh before wiring the data source.","Treat serverAddr and path as required properties in your config schema."],"tags":["sentinel","datasource","zookeeper","constructor-validation","java"],"backgroundTag":null,"analyzedSha":"a3f40ba8e900c8489bd520274739f17235a7721c","analyzedAt":"2026-08-14T11:10:30.678Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}