alibaba/nacos · error · NacosException

400

400

Error message

properties is null

What it means

Thrown by NamingMaintainerFactory.createNamingMaintainerService(Properties) when the properties argument is null. This is the entry-point factory for the naming maintainer client; a null properties set means there is no server address, credentials, or timeout configuration to build the service from. Error code INVALID_PARAM=400.

Source

Thrown at maintainer-client/src/main/java/com/alibaba/nacos/maintainer/client/naming/NamingMaintainerFactory.java:54

     */
    public static NamingMaintainerService createNamingMaintainerService(String serverList)
        throws NacosException {
        Properties properties = new Properties();
        properties.setProperty("serverAddr", serverList);
        return new NacosNamingMaintainerServiceImpl(properties);
    }
    
    /**
     * create Naming maintainer service.
     *
     * @param properties properties
     * @return naming maintainer service
     * @throws NacosException nacos exception
     */
    public static NamingMaintainerService createNamingMaintainerService(Properties properties)
        throws NacosException {
        if (properties == null) {
            throw new NacosException(NacosException.INVALID_PARAM, "properties is null");
        }
        return new NacosNamingMaintainerServiceImpl(properties);
    }
}

View on GitHub (pinned to 9b989acdf1)

Solutions

  1. Construct a Properties object with at minimum serverAddr set before calling the factory.
  2. If loading properties from a file/env, fail fast with a clear error when the source is unavailable rather than passing null.
  3. Use the overloaded factory variant that accepts a server address String if you do not need full Properties control.

Example fix

// before
NamingMaintainerService svc = NamingMaintainerFactory.createNamingMaintainerService(null);

// after
Properties props = new Properties();
props.setProperty(PropertyKeyConst.SERVER_ADDR, "127.0.0.1:8848");
NamingMaintainerService svc = NamingMaintainerFactory.createNamingMaintainerService(props);
Defensive patterns

Strategy: validation

Validate before calling

Properties props = new Properties();
props.setProperty(PropertyKeyConst.SERVER_ADDR, serverAddress);
if (props.getProperty(PropertyKeyConst.SERVER_ADDR) == null) {
    throw new IllegalStateException("serverAddr must be configured");
}
NamingMaintainerService svc = NamingMaintainerFactory.createNamingMaintainerService(props);

Prevention

When it happens

Trigger: Calling NamingMaintainerFactory.createNamingMaintainerService(null) directly, or passing a Properties reference that was never instantiated (e.g. loaded from a config file that failed to parse).

Common situations: Loading properties from an external file or environment that was missing, leaving the Properties object null. Dependency injection misconfiguration where the Properties bean is not defined. Copy-pasting example code that omitted the properties construction step.

Related errors


AI-assisted analysis of alibaba/nacos@9b989acdf1 (2026-08-14). Data as JSON: /api/errors/9b90cb99315a4c94. Report an issue: GitHub.