alibaba/spring-cloud-alibaba · error · RuntimeException
[Sentinel Starter] DataSource {dataSourceName}dataType is cu
Error message
[Sentinel Starter] DataSource {dataSourceName}dataType is custom, please set converter-class property What it means
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).
Source
Thrown at spring-cloud-alibaba-starters/spring-cloud-starter-alibaba-sentinel/src/main/java/com/alibaba/cloud/sentinel/custom/SentinelDataSourceHandler.java:145
propertyMap.put(CONVERTER_CLASS_FIELD, dataSourceProperties.getConverterClass());
propertyMap.put(DATA_TYPE_FIELD, dataSourceProperties.getDataType());
BeanDefinitionBuilder builder = BeanDefinitionBuilder
.genericBeanDefinition(dataSourceProperties.getFactoryBeanName());
propertyMap.forEach((propertyName, propertyValue) -> {
Field field = ReflectionUtils.findField(dataSourceProperties.getClass(),
propertyName);
if (null == field) {
return;
}
if (DATA_TYPE_FIELD.equals(propertyName)) {
String dataType = StringUtils.trimAllWhitespace(propertyValue.toString());
if (CUSTOM_DATA_TYPE.equals(dataType)) {
try {
if (!StringUtils
.hasLength(dataSourceProperties.getConverterClass())) {
throw new RuntimeException("[Sentinel Starter] DataSource "
+ dataSourceName
+ "dataType is custom, please set converter-class "
+ "property");
}
// construct custom Converter with 'converterClass'
// configuration and register
String customConvertBeanName = "sentinel-"
+ dataSourceProperties.getConverterClass();
if (!this.beanFactory.containsBean(customConvertBeanName)) {
this.beanFactory.registerBeanDefinition(customConvertBeanName,
BeanDefinitionBuilder
.genericBeanDefinition(
Class.forName(dataSourceProperties
.getConverterClass()))
.getBeanDefinition());
}
builder.addPropertyReference("converter", customConvertBeanName);
}View on GitHub (pinned to 115d590110)
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.
Example fix
# before spring.cloud.sentinel.datasource.ds1.data-type=custom # after spring.cloud.sentinel.datasource.ds1.data-type=custom spring.cloud.sentinel.datasource.ds1.converter-class=com.example.MyRuleConverter
Defensive patterns
Strategy: validation
Validate before calling
void validateCustomType(String dataType, String converterClass) {
if ("custom".equals(dataType) && (converterClass == null || converterClass.isBlank()))
throw new IllegalStateException("data-type=custom requires converter-class");
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- [Sentinel Starter] DataSource {dataSourceName} handle {class
- [Sentinel Starter] DataSource {dataSourceName} dataType: {pr
- ConsulDataSource server-host is empty
- ConsulDataSource ruleKey can not be empty
- [Sentinel Starter] DataSource {} file cannot be null
AI-assisted analysis of alibaba/spring-cloud-alibaba@115d590110 (2026-08-14).
Data as JSON: /api/errors/7f844232f7a86edd.
Report an issue: GitHub.