alibaba/nacos · error · NacosException
400
400
Error message
properties is null
What it means
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.
Source
Thrown at client-basic/src/main/java/com/alibaba/nacos/client/address/AbstractServerListProvider.java:43
import java.util.List;
/**
* Address server list provider.
*
* @author totalo
*/
public abstract class AbstractServerListProvider implements ServerListProvider {
protected String contextPath = ClientBasicParamUtil.getDefaultContextPath();
protected String namespace = "";
@Override
public void init(final NacosClientProperties properties,
final NacosRestTemplate nacosRestTemplate) throws NacosException {
if (null == properties) {
throw new NacosException(NacosException.INVALID_PARAM, "properties is null");
}
initContextPath(properties);
initNameSpace(properties);
}
/**
* Get server list.
* @return server list
*/
@Override
public abstract List<String> getServerList();
/**
* Get server name.
* @return server name
*/
@Override
public abstract String getServerName();View on GitHub (pinned to 9b989acdf1)
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.
Example fix
// before (custom provider)
@Override
public void init(NacosRestTemplate template) {
super.init(null, template);
}
// after
@Override
public void init(NacosClientProperties props, NacosRestTemplate template) throws NacosException {
super.init(props == null ? NacosClientProperties.PROTOTYPE.derive() : props, template);
} Defensive patterns
Strategy: validation
Validate before calling
if (properties == null) {
properties = NacosClientProperties.PROTOTYPE.derive();
}
serverListProvider.init(properties, restTemplate); Try / catch
try {
provider.init(properties, restTemplate);
} catch (NacosException e) {
if (e.getErrCode() == NacosException.INVALID_PARAM && e.getMessage().contains("properties is null")) {
properties = NacosClientProperties.PROTOTYPE.derive();
provider.init(properties, restTemplate);
} else {
throw e;
}
} Prevention
- 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().
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Agent replacement must not be null
- Agent publish request must not be null
- AgentResourceExt must not be null
- {fieldName} must not be null
- 400
AI-assisted analysis of alibaba/nacos@9b989acdf1 (2026-08-14).
Data as JSON: /api/errors/1276921a78b954c9.
Report an issue: GitHub.