alibaba/spring-cloud-alibaba · warning · IllegalArgumentException
The message queue is not in assigned list
Error message
The message queue is not in assigned list
What it means
During pull-consumer doReceive, the adapter maps the pulled message's (topic, queueId, brokerName) to a MessageQueue in the locally cached assigned set (messageQueuesForTopic). If no match is found it throws IllegalArgumentException. This happens when the assignment cache is stale relative to a rebalance that moved that queue away.
Source
Thrown at spring-cloud-alibaba-starters/spring-cloud-starter-stream-rocketmq/src/main/java/com/alibaba/cloud/stream/binder/rocketmq/integration/inbound/pull/RocketMQMessageSource.java:167
}
if (messageExtIterator == null) {
List<MessageExt> messageExtList = consumer.poll();
if (CollectionUtils.isEmpty(messageExtList)) {
return null;
}
messageExtIterator = messageExtList.iterator();
}
MessageExt messageExt = messageExtIterator.next();
if (!messageExtIterator.hasNext()) {
messageExtIterator = null;
}
if (null == messageExt) {
return null;
}
MessageQueue messageQueue = this.acquireCurrentMessageQueue(messageExt.getTopic(),
messageExt.getQueueId(), messageExt.getBrokerName());
if (messageQueue == null) {
throw new IllegalArgumentException(
"The message queue is not in assigned list");
}
Message message = RocketMQMessageConverterSupport
.convertMessage2Spring(messageExt);
return MessageBuilder.fromMessage(message)
.setHeader(IntegrationMessageHeaderAccessor.ACKNOWLEDGMENT_CALLBACK,
new RocketMQAckCallback(this.consumer, messageQueue, messageExt))
.build();
}
@Override
public String getComponentType() {
return "rocketmq:message-source";
}
}
View on GitHub (pinned to 115d590110)
Solutions
- Catch and treat as a transient condition: skip/retry the next poll so the assignment cache refreshes.
- Ensure the TopicMessageQueueChangeListener fires and messageQueuesForTopic updates after rebalance.
- Verify name-server/namespace consistency so the assigned set matches the broker's view.
Example fix
// before
MessageQueue mq = acquireCurrentMessageQueue(topic, queueId, brokerName);
if (mq == null) throw new IllegalArgumentException(...); // raw
// after - tolerate stale assignment
MessageQueue mq = acquireCurrentMessageQueue(topic, queueId, brokerName);
if (mq == null) {
log.warn("Queue {}@{} not in assigned list; skipping (rebalance?)", queueId, brokerName);
return null; // caller will poll again
} Defensive patterns
Strategy: try-catch
Try / catch
// Treat the 'not in assigned list' throw as a soft skip in the poll loop.
try {
return source.receive();
} catch (IllegalArgumentException ex) {
if (ex.getMessage() != null && ex.getMessage().contains("not in assigned list")) {
log.debug("Transient assignment mismatch, will retry next poll");
return null;
}
throw ex;
} Prevention
- Expect queue assignment to lag rebalance; design poll loops to skip/retry.
- Keep the TopicMessageQueueChangeListener wired so the cache refreshes.
- Align name-server and namespace across producer/consumer.
When it happens
Trigger: A polled MessageExt references a queue not present in messageQueuesForTopic (stale assignment cache after rebalance, broker name mismatch, or topic namespace drift).
Common situations: Cluster rebalance reassigning queues between polls; broker failover changing brokerName; namespace/nameserver mismatch so the cached set is for a different logical topic; a race between the TopicMessageQueueChangeListener update and poll.
Related errors
- group must be configured for DLQ{topic}
- Already acknowledged
- pull consumer already running. {this.toString()}
- group must be configured for DLQ{destination.getName()}
- DefaultMQPushConsumer init failed, Caused by {e.getMessage()
AI-assisted analysis of alibaba/spring-cloud-alibaba@115d590110 (2026-08-14).
Data as JSON: /api/errors/d4a2d2c035ae378d.
Report an issue: GitHub.