apache/rocketmq · error · IllegalArgumentException

mqAll is null or mqAll empty

Error message

mqAll is null or mqAll empty

What it means

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.

Source

Thrown at broker/src/main/java/org/apache/rocketmq/broker/processor/QueryAssignmentProcessor.java:283

                    }
                }
            } else {
                //make sure each cid is assigned
                allocateResult = allocate(consumerGroup, clientId, mqAll, cidAll);
            }
        }

        return allocateResult;
    }

    private List<MessageQueue> allocate(String consumerGroup, String currentCID, List<MessageQueue> mqAll,
        List<String> cidAll) {
        if (StringUtils.isBlank(currentCID)) {
            throw new IllegalArgumentException("currentCID is empty");
        }

        if (CollectionUtils.isEmpty(mqAll)) {
            throw new IllegalArgumentException("mqAll is null or mqAll empty");
        }
        if (CollectionUtils.isEmpty(cidAll)) {
            throw new IllegalArgumentException("cidAll is null or cidAll empty");
        }

        List<MessageQueue> result = new ArrayList<>();
        if (!cidAll.contains(currentCID)) {
            log.info("[BUG] ConsumerGroup: {} The consumerId: {} not in cidAll: {}",
                consumerGroup,
                currentCID,
                cidAll);
            return result;
        }

        int index = cidAll.indexOf(currentCID);
        result.add(mqAll.get(index % mqAll.size()));
        return result;
    }

View on GitHub (pinned to 293f588571)

Solutions

  1. Confirm the topic exists with read queues > 0 (mqAdmin topicList / topicRoute).
  2. Create the topic before starting consumers; wait a route-refresh interval after creation.
  3. If queues were scaled to zero intentionally, stop or pause the consumer group.
Defensive patterns

Strategy: validation

Validate before calling

TopicRouteData route = mqAdmin.examineTopicRouteInfo(topic);
if (route.getQueueDatas().stream().mapToInt(QueueData::getReadQueueNums).sum() == 0) {
    // create topic / wait for route before consuming
}

Type guard

boolean topicHasReadableQueues(TopicRouteData r) {
    return r != null && r.getQueueDatas().stream().anyMatch(q -> q.getReadQueueNums() > 0);
}

Prevention

When it happens

Trigger: 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.

Common situations: Consumers starting before the topic is created; just-deleted topic with live consumers; name-server route cache stale right after topic creation.

Related errors


AI-assisted analysis of apache/rocketmq@293f588571 (2026-08-14). Data as JSON: /api/errors/c6f71dadfd9051b9. Report an issue: GitHub.