{"record":{"id":"c6f71dadfd9051b9","repo":"apache/rocketmq","slug":"mqall-is-null-or-mqall-empty","errorCode":null,"errorMessage":"mqAll is null or mqAll empty","messagePattern":"mqAll is null or mqAll empty","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"broker/src/main/java/org/apache/rocketmq/broker/processor/QueryAssignmentProcessor.java","lineNumber":283,"sourceCode":"                    }\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\n        int index = cidAll.indexOf(currentCID);\n        result.add(mqAll.get(index % mqAll.size()));\n        return result;\n    }","sourceCodeStart":265,"sourceCodeEnd":301,"githubUrl":"https://github.com/apache/rocketmq/blob/293f5885719fc4aa3619446a1900f58ccfcfdd29/broker/src/main/java/org/apache/rocketmq/broker/processor/QueryAssignmentProcessor.java#L265-L301","documentation":"QueryAssignmentProcessor.allocate requires the message-queue list (all queues of the topic across brokers) to be non-empty; empty mqAll means the assignment ran for a topic with zero readable queues, throwing IllegalArgumentException.","triggerScenarios":"QUERY_ASSIGNMENT for a topic whose queue metadata is empty on the broker route — topic deleted, queues not yet registered with the name server, or route info not yet propagated.","commonSituations":"Consumers starting before the topic is created; just-deleted topic with live consumers; name-server route cache stale right after topic creation.","solutions":["Confirm the topic exists with read queues > 0 (mqAdmin topicList / topicRoute).","Create the topic before starting consumers; wait a route-refresh interval after creation.","If queues were scaled to zero intentionally, stop or pause the consumer group."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"TopicRouteData route = mqAdmin.examineTopicRouteInfo(topic);\nif (route.getQueueDatas().stream().mapToInt(QueueData::getReadQueueNums).sum() == 0) {\n    // create topic / wait for route before consuming\n}","typeGuard":"boolean topicHasReadableQueues(TopicRouteData r) {\n    return r != null && r.getQueueDatas().stream().anyMatch(q -> q.getReadQueueNums() > 0);\n}","tryCatchPattern":null,"preventionTips":["Create topics before starting consumer groups.","Allow a route-propagation delay after topic creation before consumers subscribe."],"tags":["rocketmq","broker","rebalance","query-assignment","topic-route","validation"],"backgroundTag":null,"analyzedSha":"293f5885719fc4aa3619446a1900f58ccfcfdd29","analyzedAt":"2026-08-14T11:50:13.822Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}