apache/rocketmq · error · MQClientException

The message queue is not in assigned list, message queue:

Error message

The message queue is not in assigned list, message queue: 

What it means

The ASSIGN-mode branch of the same seek() guard in DefaultLitePullConsumerImpl. With assign() (manual queue management, no rebalancing), a queue missing from the assigned list is a plain configuration mistake, so the message drops the "may be rebalancing" hint. Common causes are broker/topic/queueId mismatches between the MessageQueue you seek and the one you assigned.

Source

Thrown at client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultLitePullConsumerImpl.java:671

        }

        return Collections.emptyList();
    }

    public void pause(Collection<MessageQueue> messageQueues) {
        assignedMessageQueue.pause(messageQueues);
    }

    public void resume(Collection<MessageQueue> messageQueues) {
        assignedMessageQueue.resume(messageQueues);
    }

    public synchronized void seek(MessageQueue messageQueue, long offset) throws MQClientException {
        if (!assignedMessageQueue.getAssignedMessageQueues().contains(messageQueue)) {
            if (subscriptionType == SubscriptionType.SUBSCRIBE) {
                throw new MQClientException("The message queue is not in assigned list, may be rebalancing, message queue: " + messageQueue, null);
            } else {
                throw new MQClientException("The message queue is not in assigned list, message queue: " + messageQueue, null);
            }
        }
        long minOffset = minOffset(messageQueue);
        long maxOffset = maxOffset(messageQueue);
        if (offset < minOffset || offset > maxOffset) {
            throw new MQClientException("Seek offset illegal, seek offset = " + offset + ", min offset = " + minOffset + ", max offset = " + maxOffset, null);
        }
        final Object objLock = messageQueueLock.fetchLockObject(messageQueue);
        synchronized (objLock) {
            clearMessageQueueInCache(messageQueue);

            PullTaskImpl oldPullTaskImpl = this.taskTable.get(messageQueue);
            if (oldPullTaskImpl != null) {
                oldPullTaskImpl.tryInterrupt();
                this.taskTable.remove(messageQueue);
            }
            assignedMessageQueue.setSeekOffset(messageQueue, offset);
            if (!this.taskTable.containsKey(messageQueue)) {

View on GitHub (pinned to 293f588571)

Solutions

  1. Reuse the exact MessageQueue objects you gave to assign() when seeking
  2. Verify topic/brokerName/queueId match the assigned collection before seek
  3. Re-assign with the full queue list if the queue legitimately should be present

Example fix

// before
consumer.seek(new MessageQueue(topic, "broker-a", 3), offset);

// after
MessageQueue target = assignedQueues.stream()
    .filter(q -> q.getQueueId() == 3)
    .findFirst().orElseThrow(() -> new IllegalStateException("queue 3 not assigned"));
consumer.seek(target, offset);
Defensive patterns

Strategy: validation

Validate before calling

boolean assigned = consumer.getAssignedMessageQueue().getAssignedMessageQueues().contains(messageQueue);
if (!assigned) throw new IllegalArgumentException("queue not assigned: " + messageQueue);

Prevention

When it happens

Trigger: consumer.seek(new MessageQueue(topic, brokerName, queueId), offset) where that exact (topic, broker, queueId) triple was never passed to assign(); seeking a rebuilt MessageQueue object after re-assign.

Common situations: MessageQueue equality requires identical topic, brokerName and queueId — reconstructing it from a string or offset-store JSON with a different broker name silently misses the assignment.

Related errors


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