{"record":{"id":"a2f2fea4729d5693","repo":"alibaba/nacos","slug":"serverlist-is-empty-please-check-configuration","errorCode":null,"errorMessage":"serverList is empty,please check configuration","messagePattern":"serverList is empty,please check configuration","errorType":"exception","errorClass":"NacosLoadException","httpStatus":null,"severity":"critical","filePath":"client/src/main/java/com/alibaba/nacos/client/naming/core/NamingServerListManager.java","lineNumber":64,"sourceCode":"    private String nacosDomain;\n    \n    private boolean isDomain;\n    \n    @JustForTest\n    public NamingServerListManager(Properties properties) {\n        this(NacosClientProperties.PROTOTYPE.derive(properties), \"\");\n    }\n    \n    public NamingServerListManager(NacosClientProperties properties, String namespace) {\n        super(properties, namespace);\n    }\n    \n    @Override\n    public void start() throws NacosException {\n        super.start();\n        List<String> serverList = getServerList();\n        if (serverList.isEmpty()) {\n            throw new NacosLoadException(\"serverList is empty,please check configuration\");\n        } else {\n            currentIndex.set(ThreadLocalRandom.current().nextInt(serverList.size()));\n        }\n        if (serverListProvider instanceof PropertiesListProvider) {\n            if (serverList.size() == 1) {\n                isDomain = true;\n                nacosDomain = serverList.get(0);\n            }\n        }\n    }\n    \n    public String getNacosDomain() {\n        return nacosDomain;\n    }\n    \n    public boolean isDomain() {\n        return isDomain;\n    }","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/client/src/main/java/com/alibaba/nacos/client/naming/core/NamingServerListManager.java#L46-L82","documentation":"Thrown by NamingServerListManager.start() (as NacosLoadException, a NacosException subclass) when the resolved server address list is empty. The naming client cannot operate without at least one server endpoint. This is a configuration/startup failure: the properties passed to the NamingService did not yield any server address (neither serverAddr nor a discovery mechanism returned hosts).","triggerScenarios":"Constructing a NamingService/NacosLockService without a serverAddr property (or with an empty/blank value); the address source (properties, endpoint, DNS) resolved to zero addresses; a typo in the property key for the server list.","commonSituations":"Missing PropertyKeyConst.SERVER_ADDR in the Properties; empty value for serverAddr; endpoint/discovery-based addressing returning nothing; misconfigured environment-specific properties; container missing the config injection.","solutions":["Set PropertyKeyConst.SERVER_ADDR (e.g. properties.put(\"serverAddr\", \"host:port\")) before constructing the NamingService/NacosLockService.","Verify the property name and value are correct and non-empty; log the properties (excluding secrets) at startup.","If using endpoint/discovery-based addressing, confirm the endpoint returns at least one address.","Fail fast at application startup with a clear message if no server is configured."],"exampleFix":"// before\nProperties props = new Properties();\nNamingService naming = NamingFactory.createNamingService(props); // throws NacosLoadException\n\n// after\nProperties props = new Properties();\nprops.put(PropertyKeyConst.SERVER_ADDR, \"127.0.0.1:8848\");\nNamingService naming = NamingFactory.createNamingService(props);","handlingStrategy":"validation","validationCode":"String serverAddr = properties.getProperty(PropertyKeyConst.SERVER_ADDR);\nif (serverAddr == null || serverAddr.trim().isEmpty()) {\n    throw new IllegalArgumentException(\"serverAddr must be configured for NamingService\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always set PropertyKeyConst.SERVER_ADDR before constructing NamingService/NacosLockService.","Validate configuration at application startup and fail fast.","Log the (non-secret) connection properties to catch typos."],"tags":["naming","configuration","server-list","startup","no-servers"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}