{"record":{"id":"c65ecee92c87b335","repo":"apache/rocketmq","slug":"the-message-queue-is-not-in-assigned-list-may-be","errorCode":null,"errorMessage":"The message queue is not in assigned list, may be rebalancing, message queue: ","messagePattern":"The message queue is not in assigned list, may be rebalancing, message queue: ","errorType":"exception","errorClass":"MQClientException","httpStatus":null,"severity":"warning","filePath":"client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultLitePullConsumerImpl.java","lineNumber":669,"sourceCode":"        } catch (InterruptedException ignore) {\n\n        }\n\n        return Collections.emptyList();\n    }\n\n    public void pause(Collection<MessageQueue> messageQueues) {\n        assignedMessageQueue.pause(messageQueues);\n    }\n\n    public void resume(Collection<MessageQueue> messageQueues) {\n        assignedMessageQueue.resume(messageQueues);\n    }\n\n    public synchronized void seek(MessageQueue messageQueue, long offset) throws MQClientException {\n        if (!assignedMessageQueue.getAssignedMessageQueues().contains(messageQueue)) {\n            if (subscriptionType == SubscriptionType.SUBSCRIBE) {\n                throw new MQClientException(\"The message queue is not in assigned list, may be rebalancing, message queue: \" + messageQueue, null);\n            } else {\n                throw new MQClientException(\"The message queue is not in assigned list, message queue: \" + messageQueue, null);\n            }\n        }\n        long minOffset = minOffset(messageQueue);\n        long maxOffset = maxOffset(messageQueue);\n        if (offset < minOffset || offset > maxOffset) {\n            throw new MQClientException(\"Seek offset illegal, seek offset = \" + offset + \", min offset = \" + minOffset + \", max offset = \" + maxOffset, null);\n        }\n        final Object objLock = messageQueueLock.fetchLockObject(messageQueue);\n        synchronized (objLock) {\n            clearMessageQueueInCache(messageQueue);\n\n            PullTaskImpl oldPullTaskImpl = this.taskTable.get(messageQueue);\n            if (oldPullTaskImpl != null) {\n                oldPullTaskImpl.tryInterrupt();\n                this.taskTable.remove(messageQueue);\n            }","sourceCodeStart":651,"sourceCodeEnd":687,"githubUrl":"https://github.com/apache/rocketmq/blob/293f5885719fc4aa3619446a1900f58ccfcfdd29/client/src/main/java/org/apache/rocketmq/client/impl/consumer/DefaultLitePullConsumerImpl.java#L651-L687","documentation":"DefaultLitePullConsumerImpl.seek() throws this MQClientException when the given MessageQueue is not in the assigned queue list AND the consumer is in SUBSCRIBE mode (queues managed by rebalancing). The suffix \"may be rebalancing\" signals that rebalance has (possibly temporarily) moved the queue away from this consumer, so seeking it locally is impossible.","triggerScenarios":"Calling seek(queue, offset) for a queue obtained from fetchMessageQueues(topic) rather than the currently assigned set; seeking during a rebalance that reassigned the queue to another consumer in the group.","commonSituations":"Group membership churn (consumers joining/leaving) causing queues to move; seeking immediately after start() before the first rebalance completes; using a queue from a previous assignment.","solutions":["Wait for rebalance to settle (e.g. check assignedMessageQueue via getAssignedMessageQueue()) then retry seek","Only seek queues you obtained from the current assignment, not from fetchMessageQueues","Stabilize the consumer group (fixed instance count) to stop queues flapping"],"exampleFix":"// before\nconsumer.seek(queueFromFetch, offset);\n\n// after\nif (consumer.getAssignedMessageQueue().getAssignedMessageQueues().contains(queueFromFetch)) {\n    consumer.seek(queueFromFetch, offset);\n} else {\n    // wait for rebalance and retry, or log and skip\n}","handlingStrategy":"retry","validationCode":"if (consumer.getAssignedMessageQueue().getAssignedMessageQueues().contains(messageQueue)) {\n    consumer.seek(messageQueue, offset);\n}","typeGuard":null,"tryCatchPattern":"try {\n    consumer.seek(q, offset);\n} catch (MQClientException e) {\n    if (e.getMessage().contains(\"may be rebalancing\")) {\n        // transient: sleep briefly, verify assignment, retry seek once\n    } else throw e;\n}","preventionTips":["Seek only queues from the current assignment, not from fetchMessageQueues","Keep consumer group membership stable to reduce queue flapping"],"tags":["rocketmq","consumer","seek","rebalance","transient"],"backgroundTag":null,"analyzedSha":"293f5885719fc4aa3619446a1900f58ccfcfdd29","analyzedAt":"2026-08-14T11:50:13.822Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}