{"record":{"id":"03a862a0ccaedaa2","repo":"apache/rocketmq","slug":"failed-tp-get-max-offset-in-queue","errorCode":null,"errorMessage":"Failed tp get max offset in queue","messagePattern":"Failed tp get max offset in queue","errorType":"exception","errorClass":"RemotingCommandException","httpStatus":null,"severity":"error","filePath":"broker/src/main/java/org/apache/rocketmq/broker/processor/PullMessageProcessor.java","lineNumber":550,"sourceCode":"        }\n\n        final boolean useResetOffsetFeature = brokerController.getBrokerConfig().isUseServerSideResetOffset();\n        String topic = requestHeader.getTopic();\n        String liteTopic = requestHeader.getLiteTopic();\n        String group = requestHeader.getConsumerGroup();\n        int queueId = requestHeader.getQueueId();\n        Long resetOffset = brokerController.getConsumerOffsetManager().queryThenEraseResetOffset(topic, group, queueId);\n\n        GetMessageResult getMessageResult = null;\n        if (useResetOffsetFeature && null != resetOffset) {\n            getMessageResult = new GetMessageResult();\n            getMessageResult.setStatus(GetMessageStatus.OFFSET_RESET);\n            getMessageResult.setNextBeginOffset(resetOffset);\n            getMessageResult.setMinOffset(messageStore.getMinOffsetInQueue(topic, queueId));\n            try {\n                getMessageResult.setMaxOffset(messageStore.getMaxOffsetInQueue(topic, queueId));\n            } catch (ConsumeQueueException e) {\n                throw new RemotingCommandException(\"Failed tp get max offset in queue\", e);\n            }\n            getMessageResult.setSuggestPullingFromSlave(false);\n        } else {\n            long broadcastInitOffset = queryBroadcastPullInitOffset(topic, group, queueId, requestHeader, channel);\n            if (broadcastInitOffset >= 0) {\n                getMessageResult = new GetMessageResult();\n                getMessageResult.setStatus(GetMessageStatus.OFFSET_RESET);\n                getMessageResult.setNextBeginOffset(broadcastInitOffset);\n            } else {\n                SubscriptionData finalSubscriptionData = subscriptionData;\n                RemotingCommand finalResponse = response;\n                String storeTopic = topic;\n                if (StringUtils.isNotBlank(liteTopic)) {\n                    storeTopic = LiteUtil.toLmqName(topic, liteTopic);\n                }\n                messageStore.getMessageAsync(group, storeTopic, queueId, requestHeader.getQueueOffset(),\n                        requestHeader.getMaxMsgNums(), messageFilter)\n                    .thenApply(result -> {","sourceCodeStart":532,"sourceCodeEnd":568,"githubUrl":"https://github.com/apache/rocketmq/blob/293f5885719fc4aa3619446a1900f58ccfcfdd29/broker/src/main/java/org/apache/rocketmq/broker/processor/PullMessageProcessor.java#L532-L568","documentation":"PullMessageProcessor offset-reset path: when a reset offset is pending (queryThenEraseResetOffset hit), it fills GetMessageResult.maxOffset via getMaxOffsetInQueue; ConsumeQueueException is wrapped as RemotingCommandException. Note the message itself contains a typo ('Failed tp get') — search for the exact misspelling when grepping logs.","triggerScenarios":"A pull arrives for a group/queue with a pending reset offset (issued via resetOffset API) while the consume queue for that queue cannot be read.","commonSituations":"Ops run resetOffsetByTime/Id immediately after broker restart with store still loading; corrupt consume queue on the target queue; RocksDB consume queue errors.","solutions":["Let the broker finish loading its store before issuing offset resets and letting consumers pull.","Check the wrapped ConsumeQueueException in broker.log for the failing topic/queue.","Repair consume queues/disk; after store is healthy, re-issue the reset (the erased reset offset must be set again)."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"catch (RemotingCommandException e) { if (e.getMessage().contains(\"Failed tp get max offset\")) { // note typo in broker message\n    reissueResetOffsetAndRetryPull(); } else throw e; }","preventionTips":["Issue resetOffset only after broker store is fully loaded.","Consumers should tolerate and retry the pull; the reset marker is erased on read, so re-issue the reset after recovery."],"tags":["rocketmq","broker","pull","offset-reset","consume-queue","typo","storage"],"backgroundTag":null,"analyzedSha":"293f5885719fc4aa3619446a1900f58ccfcfdd29","analyzedAt":"2026-08-14T11:50:13.822Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}