{"record":{"id":"101a8a76d9438efc","repo":"apache/rocketmq","slug":"the-specified-group-is-blank","errorCode":null,"errorMessage":"the specified group is blank","messagePattern":"the specified group is blank","errorType":"validation","errorClass":"MQClientException","httpStatus":null,"severity":"error","filePath":"client/src/main/java/org/apache/rocketmq/client/Validators.java","lineNumber":52,"sourceCode":"\n/**\n * Common Validator\n */\npublic class Validators {\n    public static final int CHARACTER_MAX_LENGTH = 255;\n    public static final int TOPIC_MAX_LENGTH = 127;\n    /*\n     * Group name max length is 120, for it will be used to make up retry and DLQ topic,\n     * like pull retry: %RETRY%group_topic and pop retry: %RETRY%group_topic.\n     */\n    public static final int GROUP_MAX_LENGTH = 120;\n\n    /**\n     * Validate group\n     */\n    public static void checkGroup(String group) throws MQClientException {\n        if (UtilAll.isBlank(group)) {\n            throw new MQClientException(\"the specified group is blank\", null);\n        }\n\n        if (group.length() > GROUP_MAX_LENGTH) {\n            throw new MQClientException(String.format(\"the specified group[%s] is longer than group max length: %s.\", group, GROUP_MAX_LENGTH), null);\n        }\n\n        if (isTopicOrGroupIllegal(group)) {\n            throw new MQClientException(String.format(\n                    \"the specified group[%s] contains illegal characters, allowing only %s\", group,\n                    \"^[%|a-zA-Z0-9_-]+$\"), null);\n        }\n    }\n\n    public static void checkMessage(Message msg, DefaultMQProducer defaultMQProducer) throws MQClientException {\n        if (null == msg) {\n            throw new MQClientException(ResponseCode.MESSAGE_ILLEGAL, \"the message is null\");\n        }\n        // topic","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/apache/rocketmq/blob/293f5885719fc4aa3619446a1900f58ccfcfdd29/client/src/main/java/org/apache/rocketmq/client/Validators.java#L34-L70","documentation":"Validators.checkGroup rejects a consumer/producer group name that is null, empty, or whitespace-only. The group name is mandatory because RocketMQ builds internal retry/DLQ topic names from it. Thrown as MQClientException with no response code at client-side validation time, before any network call.","triggerScenarios":"Constructing DefaultMQProducer/consumer with a null or '' group name, or setting consumer group via a property/config that resolves to blank (missing env var, empty YAML value) — checkGroup runs during client startup or subscribe/send.","commonSituations":"Spring Boot @Value('${rocketmq.consumer.group}') that resolves empty because the property is undefined; copy-paste producer templates that drop setConsumerGroup; tests constructing clients inline.","solutions":["Set a non-blank group name: producer.setDefaultTopicQueueNums aside, call producer.setProducerGroup('my-group') / consumer.setConsumerGroup('my-group') before start().","If the group comes from config, add a startup assertion or fail-fast check that the property is present.","Use distinct names per logical service so retry/DLQ topics (%RETRY%group, %DLQ%group) do not collide."],"exampleFix":"// before\nDefaultMQPushConsumer c = new DefaultMQPushConsumer(null);\n\n// after\nDefaultMQPushConsumer c = new DefaultMQPushConsumer(\"order-service-consumer\");","handlingStrategy":"validation","validationCode":"static String requireGroup(String group) {\n    if (group == null || group.isBlank()) {\n        throw new IllegalArgumentException(\"consumer/producer group must be configured\");\n    }\n    return group;\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Fail fast at startup on blank group config instead of during first send/subscribe.","Use @ConfigurationProperties with validated (non-null) fields for group names.","Give each service a stable, documented group name."],"tags":["rocketmq","client","group","validation","configuration"],"backgroundTag":null,"analyzedSha":"293f5885719fc4aa3619446a1900f58ccfcfdd29","analyzedAt":"2026-08-14T11:50:13.822Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}