{"record":{"id":"ed5639042bd9f2b0","repo":"apache/dubbo","slug":"service-field-in-configuration-is-null","errorCode":null,"errorMessage":"service field in configuration is null.","messagePattern":"service field in configuration is null\\.","errorType":"validation","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/configurator/parser/ConfigParser.java","lineNumber":192,"sourceCode":"        if (CollectionUtils.isNotEmpty(item.getProviderAddresses())) {\n            sb.append('&');\n            sb.append(OVERRIDE_PROVIDERS_KEY);\n            sb.append('=');\n            sb.append(CollectionUtils.join(item.getProviderAddresses(), \",\"));\n        } else if (PROVIDER.equals(item.getSide())) {\n            sb.append('&');\n            sb.append(OVERRIDE_PROVIDERS_KEY);\n            sb.append('=');\n            sb.append(CollectionUtils.join(parseAddresses(item), \",\"));\n        }\n\n        return sb.toString();\n    }\n\n    private static String appendService(String serviceKey) {\n        StringBuilder sb = new StringBuilder();\n        if (StringUtils.isEmpty(serviceKey)) {\n            throw new IllegalStateException(\"service field in configuration is null.\");\n        }\n\n        String interfaceName = serviceKey;\n        int i = interfaceName.indexOf('/');\n        if (i > 0) {\n            sb.append(\"group=\");\n            sb.append(interfaceName, 0, i);\n            sb.append('&');\n\n            interfaceName = interfaceName.substring(i + 1);\n        }\n        int j = interfaceName.indexOf(':');\n        if (j > 0) {\n            sb.append(\"version=\");\n            sb.append(interfaceName.substring(j + 1));\n            sb.append('&');\n            interfaceName = interfaceName.substring(0, j);\n        }","sourceCodeStart":174,"sourceCodeEnd":210,"githubUrl":"https://github.com/apache/dubbo/blob/3a3043227f5571d25eb2889de5bca22f2914843b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/configurator/parser/ConfigParser.java#L174-L210","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Provide a non-empty service key: the service interface name, optionally as group/interface:version.","If configuring at application scope, ensure scope is set to 'application' so the service-key path is not required from config.getKey().","Check the YAML so the service field is correctly populated and not swallowed by indentation."],"exampleFix":"# before (broken)\nconfigVersion: v2.7\nscope: service\nkey: \"\"\nconfigs:\n  - items:\n      - parameters: { timeout: 2000 }\n\n# after\nconfigVersion: v2.7\nscope: service\nkey: \"org.example.FooService\"\nconfigs:\n  - items:\n      - parameters: { timeout: 2000 }","handlingStrategy":"validation","validationCode":"// Validate service key before parsing a service-scoped configurator\nString key = config.getKey();\nif (StringUtils.isEmpty(key)) {\n    throw new IllegalArgumentException(\n        \"Service-scoped configurator requires a non-empty service key (interface [+group/version]).\");\n}\nList<URL> urls = ConfigParser.parseConfigurators(rawConfig);","typeGuard":null,"tryCatchPattern":"try {\n    ConfigParser.parseConfigurators(rawConfig);\n} catch (IllegalStateException e) {\n    throw new ConfigValidationException(\"Configurator missing service field: \" + e.getMessage(), e);\n}","preventionTips":["For service scope, always set the service interface as the key.","Use application scope if you do not want to target a specific service.","Validate YAML indentation of the key/services fields before publishing."],"tags":["config","configurator","governance","validation"],"backgroundTag":null,"analyzedSha":"3a3043227f5571d25eb2889de5bca22f2914843b","analyzedAt":"2026-08-14T00:43:19.853Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}