{"record":{"id":"99e868c5881e123a","repo":"apache/skywalking","slug":"zookeeper-hostport-cannot-be-null-or-empty","errorCode":null,"errorMessage":"Zookeeper hostPort cannot be null or empty.","messagePattern":"Zookeeper hostPort cannot be null or empty\\.","errorType":"exception","errorClass":"ModuleStartException","httpStatus":null,"severity":"critical","filePath":"oap-server/server-configuration/configuration-zookeeper/src/main/java/org/apache/skywalking/oap/server/configuration/zookeeper/ZookeeperConfigurationProvider.java","lineNumber":55,"sourceCode":"    @Override\n    public ConfigCreator newConfigCreator() {\n        return new ConfigCreator<ZookeeperServerSettings>() {\n            @Override\n            public Class type() {\n                return ZookeeperServerSettings.class;\n            }\n\n            @Override\n            public void onInitialized(final ZookeeperServerSettings initialized) {\n                settings = initialized;\n            }\n        };\n    }\n\n    @Override\n    protected ConfigWatcherRegister initConfigReader() throws ModuleStartException {\n        if (Strings.isNullOrEmpty(settings.getHostPort())) {\n            throw new ModuleStartException(\"Zookeeper hostPort cannot be null or empty.\");\n        }\n        if (Strings.isNullOrEmpty(settings.getNamespace())) {\n            throw new ModuleStartException(\"Zookeeper namespace cannot be null or empty.\");\n        }\n\n        try {\n            return new ZookeeperConfigWatcherRegister(settings);\n        } catch (Exception e) {\n            throw new ModuleStartException(e.getMessage(), e);\n        }\n    }\n}\n","sourceCodeStart":37,"sourceCodeEnd":68,"githubUrl":"https://github.com/apache/skywalking/blob/102af09b4a56064e22050dded10e2c52e490d040/oap-server/server-configuration/configuration-zookeeper/src/main/java/org/apache/skywalking/oap/server/configuration/zookeeper/ZookeeperConfigurationProvider.java#L37-L68","documentation":"This ModuleStartException is thrown by the ZooKeeper configuration provider during OAP startup when the 'hostPort' setting of the cluster/configuration ZooKeeper connection is null or empty (checked with Guava Strings.isNullOrEmpty). The provider refuses to build a ZookeeperConfigWatcherRegister because a Curator client cannot connect without a target address. It is a fail-fast boot-time validation error, not a runtime connectivity error.","triggerScenarios":"Selecting configuration-zookeeper as the configuration sync provider (or zookeeper cluster provider sharing these settings) in application.yml while leaving the hostPort key absent, commented out, or set to an empty string. The check runs in initConfigReader() before settings.getHostPort() is ever passed to Curator.","commonSituations":"Copying a template application.yml and renaming providers without filling in the zookeeper block; YAML indentation mistakes that make the hostPort key parse as part of a different node; relying on environment-variable substitution that resolves to empty.","solutions":["Set cluster/configuration zookeeper hostPort in application.yml, e.g. hostPort: zk1:2181,zk2:2181,zk3:2181","Verify YAML indentation so hostPort sits directly under the zookeeper settings block","If using env substitution (${SW_ZK_HOSTPORT}), confirm the variable is exported and non-empty in the launch environment","After fixing, restart OAP — the error is boot-time only"],"exampleFix":"# before (application.yml)\nconfiguration:\n  selector: zookeeper\n  zookeeper:\n    namespace: skywalking\n# hostPort missing -> error\n\n# after\nconfiguration:\n  selector: zookeeper\n  zookeeper:\n    hostPort: zk1:2181,zk2:2181\n    namespace: skywalking","handlingStrategy":"validation","validationCode":"String hostPort = System.getenv().getOrDefault(\"SW_ZK_HOSTPORT\", \"\");\nif (hostPort == null || hostPort.trim().isEmpty()) {\n    throw new IllegalStateException(\"Configure zookeeper hostPort before starting OAP\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Render application.yml through a config lint (yaml parse + required-key check) before deploying OAP","Keep a checked-in baseline application.yml per environment so required keys like hostPort are never hand-deleted","In containers, use env-var substitution with non-empty defaults and a startup healthcheck that greps the boot log for ModuleStartException"],"tags":["zookeeper","configuration","startup","oap-server"],"backgroundTag":null,"analyzedSha":"102af09b4a56064e22050dded10e2c52e490d040","analyzedAt":"2026-08-14T10:47:52.647Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}