alibaba/spring-cloud-alibaba · error · IllegalArgumentException
RedisDataSource channel can not be empty
Error message
RedisDataSource channel can not be empty
What it means
Thrown by RedisDataSourceProperties.preCheck when the channel field is null or empty. The channel is the Redis pub/sub channel that Sentinel subscribes to for rule change notifications. Note the double space in the original message string ('RedisDataSource channel'). This check fires after the ruleKey check passes.
Source
Thrown at spring-cloud-alibaba-starters/spring-cloud-alibaba-sentinel-datasource/src/main/java/com/alibaba/cloud/sentinel/datasource/config/RedisDataSourceProperties.java:93
* channel to subscribe in Redis.
*/
private @Nullable String channel;
/**
* redis sentinel model.
*/
private @Nullable String masterId;
@Override
public void preCheck(String dataSourceName) {
super.preCheck(dataSourceName);
if (StringUtils.isEmpty(ruleKey)) {
throw new IllegalArgumentException(
"RedisDataSource ruleKey can not be empty");
}
if (StringUtils.isEmpty(channel)) {
throw new IllegalArgumentException(
"RedisDataSource channel can not be empty");
}
if (StringUtils.isEmpty(masterId)) {
throw new IllegalArgumentException(
"RedisDataSource sentinel model,masterId can not be empty");
}
}
public String getHost() {
return host;
}
public void setHost(String host) {
this.host = host;
}
public int getPort() {View on GitHub (pinned to 115d590110)
Solutions
- Add spring.cloud.sentinel.datasource.<name>.redis.channel=<redis-pubsub-channel> to your configuration.
- Verify the channel matches what the rule-publisher service publishes to.
- Ensure the channel name is not empty or whitespace-only.
Example fix
# before (broken — channel missing)
spring:
cloud:
sentinel:
datasource:
ds1:
redis:
host: redis.local
ruleKey: sentinel:flow-rules
# after (fixed)
spring:
cloud:
sentinel:
datasource:
ds1:
redis:
host: redis.local
ruleKey: sentinel:flow-rules
channel: sentinel-rule-updates Defensive patterns
Strategy: validation
Validate before calling
// Ensure channel is set for redis Sentinel datasource
String channel = props.getRedis().getChannel();
if (!StringUtils.hasText(channel)) {
throw new IllegalArgumentException("RedisDataSource channel is required");
} Prevention
- Coordinate the channel name between the rule publisher and Sentinel consumer.
- Document the pub/sub channel in your infrastructure configuration alongside the Redis connection details.
- Use consistent naming conventions for Sentinel notification channels.
When it happens
Trigger: Configuring a Sentinel datasource of type 'redis' with ruleKey set but channel omitted. The channel field is @Nullable with no default, so omitting spring.cloud.sentinel.datasource.<name>.redis.channel triggers this check.
Common situations: 1) Developer sets ruleKey but forgets the pub/sub channel. 2) Channel name was changed in the publishing service but not in the consumer config. 3) Configuration copied from standalone Redis example but channel-specific property was not filled in.
Related errors
- RedisDataSource ruleKey can not be empty
- RedisDataSource sentinel model,masterId can not be empty
- Invalid redis sentinel property {}
- ConsulDataSource server-host is empty
- ConsulDataSource ruleKey can not be empty
AI-assisted analysis of alibaba/spring-cloud-alibaba@115d590110 (2026-08-14).
Data as JSON: /api/errors/51aa8384490131ba.
Report an issue: GitHub.