{"record":{"id":"20fa8542afccfb8f","repo":"apache/incubator-seata","slug":"custom-config-type-name-s-is-not-allowed","errorCode":null,"errorMessage":"custom config type name %s is not allowed","messagePattern":"custom config type name (.+?) is not allowed","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"config/seata-config-custom/src/main/java/org/apache/seata/config/custom/CustomConfigurationProvider.java","lineNumber":42,"sourceCode":"import org.apache.seata.config.ConfigurationFactory;\nimport org.apache.seata.config.ConfigurationKeys;\nimport org.apache.seata.config.ConfigurationProvider;\n\nimport java.util.stream.Stream;\n\n@LoadLevel(name = \"Custom\")\npublic class CustomConfigurationProvider implements ConfigurationProvider {\n    @Override\n    public Configuration provide() {\n        String pathDataId = ConfigurationKeys.FILE_ROOT_CONFIG + ConfigurationKeys.FILE_CONFIG_SPLIT_CHAR\n                + ConfigType.Custom.name().toLowerCase() + ConfigurationKeys.FILE_CONFIG_SPLIT_CHAR\n                + \"name\";\n        String name = ConfigurationFactory.CURRENT_FILE_INSTANCE.getConfig(pathDataId);\n        if (StringUtils.isBlank(name)) {\n            throw new IllegalArgumentException(\"name value of custom config type must not be blank\");\n        }\n        if (Stream.of(ConfigType.values()).anyMatch(ct -> ct.name().equalsIgnoreCase(name))) {\n            throw new IllegalArgumentException(String.format(\"custom config type name %s is not allowed\", name));\n        }\n        return EnhancedServiceLoader.load(ConfigurationProvider.class, name).provide();\n    }\n}\n","sourceCodeStart":24,"sourceCodeEnd":47,"githubUrl":"https://github.com/apache/incubator-seata/blob/e01f97c6db397165050caa6764020410c2c8199a/config/seata-config-custom/src/main/java/org/apache/seata/config/custom/CustomConfigurationProvider.java#L24-L47","documentation":"Thrown by CustomConfigurationProvider.provide() when the value of custom.name equals the name of a built-in ConfigType (e.g. nacos, apollo, zk, consul, etcd3, file, custom). Seata rejects it because the Custom type exists precisely to delegate to non-built-in providers; a built-in name here would either recurse (custom) or shadow native handling.","triggerScenarios":"`config.type = custom` combined with `custom.name = nacos` (or file, zk, apollo, consul, etcd3, redis, custom — matched case-insensitively). The stream check Stream.of(ConfigType.values()).anyMatch(ct -> ct.name().equalsIgnoreCase(name)) fires before the SPI load.","commonSituations":"Copy-pasting an existing config block and changing only `type: custom` while leaving the old backend name in place, or misunderstanding Custom as an alias indirection for built-in types.","solutions":["If you want a built-in backend, drop the Custom indirection: set `config.type = nacos` (etc.) directly","If you truly have a custom provider, give it a name that does not collide with any ConfigType enum constant, e.g. 'mycompany-config'","If delegating to a built-in via your own wrapper, register the wrapper under a distinct @LoadLevel name"],"exampleFix":"# before\nconfig:\n  type: custom\n  custom:\n    name: nacos\n\n# after\nconfig:\n  type: nacos\n  name: seata-server.properties","handlingStrategy":"validation","validationCode":"if (Stream.of(ConfigType.values()).anyMatch(ct -> ct.name().equalsIgnoreCase(name))) throw new IllegalStateException(\"custom.name must not be a built-in type name\");","typeGuard":null,"tryCatchPattern":"try { provider.provide(); } catch (IllegalArgumentException e) { log.error(e.getMessage()); /* fall back to direct built-in type */ }","preventionTips":["Prefix custom provider names with a namespace (e.g. acme-config)","Do not copy built-in backend names into the custom.name slot","Document the reserved built-in names for your team"],"tags":["config","seata","spi","naming"],"backgroundTag":null,"analyzedSha":"e01f97c6db397165050caa6764020410c2c8199a","analyzedAt":"2026-08-14T10:23:53.097Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}