{"record":{"id":"1276921a78b954c9","repo":"alibaba/nacos","slug":"400-127692","errorCode":"400","errorMessage":"properties is null","messagePattern":"properties is null","errorType":"validation","errorClass":"NacosException","httpStatus":400,"severity":"error","filePath":"client-basic/src/main/java/com/alibaba/nacos/client/address/AbstractServerListProvider.java","lineNumber":43,"sourceCode":"\nimport java.util.List;\n\n/**\n * Address server list provider.\n * \n * @author totalo\n */\npublic abstract class AbstractServerListProvider implements ServerListProvider {\n    \n    protected String contextPath = ClientBasicParamUtil.getDefaultContextPath();\n    \n    protected String namespace = \"\";\n    \n    @Override\n    public void init(final NacosClientProperties properties,\n        final NacosRestTemplate nacosRestTemplate) throws NacosException {\n        if (null == properties) {\n            throw new NacosException(NacosException.INVALID_PARAM, \"properties is null\");\n        }\n        initContextPath(properties);\n        initNameSpace(properties);\n    }\n    \n    /**\n     * Get server list.\n     * @return server list\n     */\n    @Override\n    public abstract List<String> getServerList();\n    \n    /**\n     * Get server name.\n     * @return server name\n     */\n    @Override\n    public abstract String getServerName();","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/client-basic/src/main/java/com/alibaba/nacos/client/address/AbstractServerListProvider.java#L25-L61","documentation":"Thrown by AbstractServerListProvider.init() with error code INVALID_PARAM (400) when the NacosClientProperties argument passed to init is null. This is a defensive null-check at the top of the init method before any property access occurs. Since init() is called internally by the ServerListManager during start(), a null properties object indicates a programming error in the caller or a broken custom provider.","triggerScenarios":"A custom ServerListProvider subclass calls super.init(null, restTemplate); or internal code passes a null properties object due to a lifecycle bug where the manager was constructed before properties were resolved.","commonSituations":"Custom SPI implementations that override init() but forward a null properties reference; test harnesses that construct providers manually without supplying properties; race conditions during client shutdown where properties are nulled out before init completes.","solutions":["Ensure NacosClientProperties is fully constructed and non-null before the ServerListManager.start() is called.","If you wrote a custom ServerListProvider, verify super.init(properties, nacosRestTemplate) receives a non-null properties argument.","Use NacosClientProperties.PROTOTYPE.derive() to create a valid properties instance rather than passing null."],"exampleFix":"// before (custom provider)\n@Override\npublic void init(NacosRestTemplate template) {\n    super.init(null, template);\n}\n\n// after\n@Override\npublic void init(NacosClientProperties props, NacosRestTemplate template) throws NacosException {\n    super.init(props == null ? NacosClientProperties.PROTOTYPE.derive() : props, template);\n}","handlingStrategy":"validation","validationCode":"if (properties == null) {\n    properties = NacosClientProperties.PROTOTYPE.derive();\n}\nserverListProvider.init(properties, restTemplate);","typeGuard":null,"tryCatchPattern":"try {\n    provider.init(properties, restTemplate);\n} catch (NacosException e) {\n    if (e.getErrCode() == NacosException.INVALID_PARAM && e.getMessage().contains(\"properties is null\")) {\n        properties = NacosClientProperties.PROTOTYPE.derive();\n        provider.init(properties, restTemplate);\n    } else {\n        throw e;\n    }\n}","preventionTips":["Never pass null NacosClientProperties to ServerListProvider.init().","Use NacosClientProperties.PROTOTYPE.derive() to create valid property instances.","In custom providers, add a null-check before calling super.init()."],"tags":["validation","server-discovery","null-check","spi"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}