{"record":{"id":"51aa8384490131ba","repo":"alibaba/spring-cloud-alibaba","slug":"redisdatasource-channel-can-not-be-empty","errorCode":null,"errorMessage":"RedisDataSource  channel can not be empty","messagePattern":"RedisDataSource  channel can not be empty","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"spring-cloud-alibaba-starters/spring-cloud-alibaba-sentinel-datasource/src/main/java/com/alibaba/cloud/sentinel/datasource/config/RedisDataSourceProperties.java","lineNumber":93,"sourceCode":"\t * channel to subscribe in Redis.\n\t */\n\tprivate @Nullable String channel;\n\n\t/**\n\t * redis sentinel model.\n\t */\n\tprivate @Nullable String masterId;\n\n\t@Override\n\tpublic void preCheck(String dataSourceName) {\n\t\tsuper.preCheck(dataSourceName);\n\t\tif (StringUtils.isEmpty(ruleKey)) {\n\t\t\tthrow new IllegalArgumentException(\n\t\t\t\t\t\"RedisDataSource  ruleKey can not be empty\");\n\t\t}\n\n\t\tif (StringUtils.isEmpty(channel)) {\n\t\t\tthrow new IllegalArgumentException(\n\t\t\t\t\t\"RedisDataSource  channel can not be empty\");\n\t\t}\n\n\t\tif (StringUtils.isEmpty(masterId)) {\n\t\t\tthrow new IllegalArgumentException(\n\t\t\t\t\t\"RedisDataSource  sentinel model，masterId can not be empty\");\n\t\t}\n\t}\n\n\tpublic String getHost() {\n\t\treturn host;\n\t}\n\n\tpublic void setHost(String host) {\n\t\tthis.host = host;\n\t}\n\n\tpublic int getPort() {","sourceCodeStart":75,"sourceCodeEnd":111,"githubUrl":"https://github.com/alibaba/spring-cloud-alibaba/blob/115d5901102009492e05d5ec18c3f79cad4077d0/spring-cloud-alibaba-starters/spring-cloud-alibaba-sentinel-datasource/src/main/java/com/alibaba/cloud/sentinel/datasource/config/RedisDataSourceProperties.java#L75-L111","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"# before (broken — channel missing)\nspring:\n  cloud:\n    sentinel:\n      datasource:\n        ds1:\n          redis:\n            host: redis.local\n            ruleKey: sentinel:flow-rules\n\n# after (fixed)\nspring:\n  cloud:\n    sentinel:\n      datasource:\n        ds1:\n          redis:\n            host: redis.local\n            ruleKey: sentinel:flow-rules\n            channel: sentinel-rule-updates","handlingStrategy":"validation","validationCode":"// Ensure channel is set for redis Sentinel datasource\nString channel = props.getRedis().getChannel();\nif (!StringUtils.hasText(channel)) {\n    throw new IllegalArgumentException(\"RedisDataSource channel is required\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["sentinel","redis","datasource","configuration","validation","pubsub"],"backgroundTag":null,"analyzedSha":"115d5901102009492e05d5ec18c3f79cad4077d0","analyzedAt":"2026-08-14T04:47:13.900Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}