apache/dubbo · error · IllegalStateException

service field in configuration is null.

Error message

service field in configuration is null.

What it means

Thrown by ConfigParser.appendService() when the serviceKey is null or empty. In service-scope configurator parsing, the service identifier (interface [+group/version]) is mandatory to build the override URL path. Without it the parser cannot target a service and aborts.

Source

Thrown at dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/configurator/parser/ConfigParser.java:192

        if (CollectionUtils.isNotEmpty(item.getProviderAddresses())) {
            sb.append('&');
            sb.append(OVERRIDE_PROVIDERS_KEY);
            sb.append('=');
            sb.append(CollectionUtils.join(item.getProviderAddresses(), ","));
        } else if (PROVIDER.equals(item.getSide())) {
            sb.append('&');
            sb.append(OVERRIDE_PROVIDERS_KEY);
            sb.append('=');
            sb.append(CollectionUtils.join(parseAddresses(item), ","));
        }

        return sb.toString();
    }

    private static String appendService(String serviceKey) {
        StringBuilder sb = new StringBuilder();
        if (StringUtils.isEmpty(serviceKey)) {
            throw new IllegalStateException("service field in configuration is null.");
        }

        String interfaceName = serviceKey;
        int i = interfaceName.indexOf('/');
        if (i > 0) {
            sb.append("group=");
            sb.append(interfaceName, 0, i);
            sb.append('&');

            interfaceName = interfaceName.substring(i + 1);
        }
        int j = interfaceName.indexOf(':');
        if (j > 0) {
            sb.append("version=");
            sb.append(interfaceName.substring(j + 1));
            sb.append('&');
            interfaceName = interfaceName.substring(0, j);
        }

View on GitHub (pinned to 3a3043227f)

Solutions

  1. Provide a non-empty service key: the service interface name, optionally as group/interface:version.
  2. If configuring at application scope, ensure scope is set to 'application' so the service-key path is not required from config.getKey().
  3. Check the YAML so the service field is correctly populated and not swallowed by indentation.

Example fix

# before (broken)
configVersion: v2.7
scope: service
key: ""
configs:
  - items:
      - parameters: { timeout: 2000 }

# after
configVersion: v2.7
scope: service
key: "org.example.FooService"
configs:
  - items:
      - parameters: { timeout: 2000 }
Defensive patterns

Strategy: validation

Validate before calling

// Validate service key before parsing a service-scoped configurator
String key = config.getKey();
if (StringUtils.isEmpty(key)) {
    throw new IllegalArgumentException(
        "Service-scoped configurator requires a non-empty service key (interface [+group/version]).");
}
List<URL> urls = ConfigParser.parseConfigurators(rawConfig);

Try / catch

try {
    ConfigParser.parseConfigurators(rawConfig);
} catch (IllegalStateException e) {
    throw new ConfigValidationException("Configurator missing service field: " + e.getMessage(), e);
}

Prevention

When it happens

Trigger: A service-scoped ConfiguratorConfig whose key (the service interface name) is blank/null; the service field is missing in the YAML/JSON configurator config passed to ConfigParser.parseConfigurators.

Common situations: Publishing a configurator rule with an empty or missing service key in dubbo-admin; mis-indenting the 'key'/'services' field so it deserializes to null; using an app-scoped config but declaring scope as service without providing the service interface.

Related errors


AI-assisted analysis of apache/dubbo@3a3043227f (2026-08-14). Data as JSON: /api/errors/ed5639042bd9f2b0. Report an issue: GitHub.