{"record":{"id":"5b201626caebbeba","repo":"apache/rocketmq","slug":"currentcid-is-empty","errorCode":null,"errorMessage":"currentCID is empty","messagePattern":"currentCID is empty","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"broker/src/main/java/org/apache/rocketmq/broker/processor/QueryAssignmentProcessor.java","lineNumber":279,"sourceCode":"                        index++;\n                        index = index % cidAll.size();\n                        List<MessageQueue> tmp = allocateMessageQueueStrategy.allocate(consumerGroup, cidAll.get(index), mqAll, cidAll);\n                        allocateResult.addAll(tmp);\n                    }\n                }\n            } else {\n                //make sure each cid is assigned\n                allocateResult = allocate(consumerGroup, clientId, mqAll, cidAll);\n            }\n        }\n\n        return allocateResult;\n    }\n\n    private List<MessageQueue> allocate(String consumerGroup, String currentCID, List<MessageQueue> mqAll,\n        List<String> cidAll) {\n        if (StringUtils.isBlank(currentCID)) {\n            throw new IllegalArgumentException(\"currentCID is empty\");\n        }\n\n        if (CollectionUtils.isEmpty(mqAll)) {\n            throw new IllegalArgumentException(\"mqAll is null or mqAll empty\");\n        }\n        if (CollectionUtils.isEmpty(cidAll)) {\n            throw new IllegalArgumentException(\"cidAll is null or cidAll empty\");\n        }\n\n        List<MessageQueue> result = new ArrayList<>();\n        if (!cidAll.contains(currentCID)) {\n            log.info(\"[BUG] ConsumerGroup: {} The consumerId: {} not in cidAll: {}\",\n                consumerGroup,\n                currentCID,\n                cidAll);\n            return result;\n        }\n","sourceCodeStart":261,"sourceCodeEnd":297,"githubUrl":"https://github.com/apache/rocketmq/blob/293f5885719fc4aa3619446a1900f58ccfcfdd29/broker/src/main/java/org/apache/rocketmq/broker/processor/QueryAssignmentProcessor.java#L261-L297","documentation":"QueryAssignmentProcessor.allocate (server-side static/rebalancing assignment for QUERY_ASSIGNMENT when exclusive consumer mode is on) validates that the requesting client's clientId is non-blank. A blank currentCID fails fast with IllegalArgumentException.","triggerScenarios":"QUERY_ASSIGNMENT request whose clientId header is empty/whitespace — broken or non-compliant client, or a custom client not setting clientId.","commonSituations":"Custom SDK/proxy omitting clientId; clientId trimmed to empty by config; older client versions incompatible with the exclusive-consume assignment path.","solutions":["Ensure the consumer client sets a unique non-empty clientId (DEFAULT_MQ_CONSUMER default is IP@instanceName).","If instanceName is overridden, verify it isn't blank and the client is a stock supported version.","Upgrade third-party clients to versions that populate clientId on QUERY_ASSIGNMENT requests."],"exampleFix":"// before\nconsumer.setClientIP(\"\"); // or instanceName blank -> blank clientId\n\n// after\nconsumer.setInstanceName(String.valueOf(System.currentTimeMillis())); // ensures non-empty unique clientId","handlingStrategy":"validation","validationCode":"if (StringUtils.isBlank(requestHeader.getClientId())) {\n    throw new IllegalArgumentException(\"clientId must be set before QUERY_ASSIGNMENT\");\n}","typeGuard":"boolean hasValidClientId(String clientId) { return clientId != null && !clientId.trim().isEmpty(); }","tryCatchPattern":null,"preventionTips":["Always configure a unique non-empty clientId/instanceName on consumers.","Use maintained SDK versions that populate clientId in assignment requests."],"tags":["rocketmq","broker","rebalance","query-assignment","client-id","validation"],"backgroundTag":null,"analyzedSha":"293f5885719fc4aa3619446a1900f58ccfcfdd29","analyzedAt":"2026-08-14T11:50:13.822Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}