{"record":{"id":"7f844232f7a86edd","repo":"alibaba/spring-cloud-alibaba","slug":"sentinel-starter-datasource-datasourcename-data","errorCode":null,"errorMessage":"[Sentinel Starter] DataSource {dataSourceName}dataType is custom, please set converter-class property","messagePattern":"\\[Sentinel Starter\\] DataSource (.+?)dataType is custom, please set converter-class property","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"spring-cloud-alibaba-starters/spring-cloud-starter-alibaba-sentinel/src/main/java/com/alibaba/cloud/sentinel/custom/SentinelDataSourceHandler.java","lineNumber":145,"sourceCode":"\t\tpropertyMap.put(CONVERTER_CLASS_FIELD, dataSourceProperties.getConverterClass());\n\t\tpropertyMap.put(DATA_TYPE_FIELD, dataSourceProperties.getDataType());\n\n\t\tBeanDefinitionBuilder builder = BeanDefinitionBuilder\n\t\t\t\t.genericBeanDefinition(dataSourceProperties.getFactoryBeanName());\n\n\t\tpropertyMap.forEach((propertyName, propertyValue) -> {\n\t\t\tField field = ReflectionUtils.findField(dataSourceProperties.getClass(),\n\t\t\t\t\tpropertyName);\n\t\t\tif (null == field) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (DATA_TYPE_FIELD.equals(propertyName)) {\n\t\t\t\tString dataType = StringUtils.trimAllWhitespace(propertyValue.toString());\n\t\t\t\tif (CUSTOM_DATA_TYPE.equals(dataType)) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (!StringUtils\n\t\t\t\t\t\t\t\t.hasLength(dataSourceProperties.getConverterClass())) {\n\t\t\t\t\t\t\tthrow new RuntimeException(\"[Sentinel Starter] DataSource \"\n\t\t\t\t\t\t\t\t\t+ dataSourceName\n\t\t\t\t\t\t\t\t\t+ \"dataType is custom, please set converter-class \"\n\t\t\t\t\t\t\t\t\t+ \"property\");\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// construct custom Converter with 'converterClass'\n\t\t\t\t\t\t// configuration and register\n\t\t\t\t\t\tString customConvertBeanName = \"sentinel-\"\n\t\t\t\t\t\t\t\t+ dataSourceProperties.getConverterClass();\n\t\t\t\t\t\tif (!this.beanFactory.containsBean(customConvertBeanName)) {\n\t\t\t\t\t\t\tthis.beanFactory.registerBeanDefinition(customConvertBeanName,\n\t\t\t\t\t\t\t\t\tBeanDefinitionBuilder\n\t\t\t\t\t\t\t\t\t\t\t.genericBeanDefinition(\n\t\t\t\t\t\t\t\t\t\t\t\t\tClass.forName(dataSourceProperties\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.getConverterClass()))\n\t\t\t\t\t\t\t\t\t\t\t.getBeanDefinition());\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbuilder.addPropertyReference(\"converter\", customConvertBeanName);\n\t\t\t\t\t}","sourceCodeStart":127,"sourceCodeEnd":163,"githubUrl":"https://github.com/alibaba/spring-cloud-alibaba/blob/115d5901102009492e05d5ec18c3f79cad4077d0/spring-cloud-alibaba-starters/spring-cloud-starter-alibaba-sentinel/src/main/java/com/alibaba/cloud/sentinel/custom/SentinelDataSourceHandler.java#L127-L163","documentation":"When a Sentinel datasource is configured with data-type 'custom', the framework expects a converter-class property naming a class that converts the raw rule payload into Sentinel rules. If converter-class is blank while data-type is custom, this RuntimeException is thrown during bean definition building. The message is missing a space between the data source name and 'dataType' (a cosmetic defect in the source).","triggerScenarios":"Setting spring.cloud.sentinel.datasource.xxx.data-type=custom without spring.cloud.sentinel.datasource.xxx.converter-class. Removing the converter-class line after switching to a custom data type.","commonSituations":"Switching from json/xml to a custom deserializer and forgetting the converter class. Typo in the converter-class property key so it is read as blank.","solutions":["Set converter-class to a fully-qualified class implementing the Sentinel Converter, e.g. spring.cloud.sentinel.datasource.xxx.converter-class=com.example.MyConverter.","If you do not need a custom converter, use a built-in data-type such as 'json' or 'xml'.","Double-check the property key spelling matches the relaxed-binding name expected by the properties object."],"exampleFix":"# before\nspring.cloud.sentinel.datasource.ds1.data-type=custom\n# after\nspring.cloud.sentinel.datasource.ds1.data-type=custom\nspring.cloud.sentinel.datasource.ds1.converter-class=com.example.MyRuleConverter","handlingStrategy":"validation","validationCode":"void validateCustomType(String dataType, String converterClass) {\n  if (\"custom\".equals(dataType) && (converterClass == null || converterClass.isBlank()))\n    throw new IllegalStateException(\"data-type=custom requires converter-class\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always set converter-class when data-type is custom.","Prefer json/xml unless you truly need a custom converter.","Keep data-type and converter-class on adjacent config lines."],"tags":["sentinel","datasource","config-validation","converter"],"backgroundTag":null,"analyzedSha":"115d5901102009492e05d5ec18c3f79cad4077d0","analyzedAt":"2026-08-14T04:47:13.900Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}