{"record":{"id":"8fc3f9e29f59d0dd","repo":"apache/rocketmq","slug":"can-not-find-message-queue-for-this-topic-topic-8fc3f9","errorCode":null,"errorMessage":"Can not find Message Queue for this topic, ${topic}\nSee https://rocketmq.apache.org/docs/faq/ for further details.","messagePattern":"Can not find Message Queue for this topic, (.+?)\nSee https://rocketmq\\.apache\\.org/docs/faq/ for further details\\.","errorType":"exception","errorClass":"MQClientException","httpStatus":null,"severity":"error","filePath":"client/src/main/java/org/apache/rocketmq/client/impl/MQAdminImpl.java","lineNumber":181,"sourceCode":"            resultQueues.add(new MessageQueue(userTopic, queue.getBrokerName(), queue.getQueueId()));\n        }\n\n        return resultQueues;\n    }\n\n    public Set<MessageQueue> fetchSubscribeMessageQueues(String topic) throws MQClientException {\n        try {\n            TopicRouteData topicRouteData = this.mQClientFactory.getMQClientAPIImpl().getTopicRouteInfoFromNameServer(topic, timeoutMillis);\n            if (topicRouteData != null) {\n                Set<MessageQueue> mqList = MQClientInstance.topicRouteData2TopicSubscribeInfo(topic, topicRouteData);\n                if (!mqList.isEmpty()) {\n                    return mqList;\n                } else {\n                    throw new MQClientException(\"Can not find Message Queue for this topic, \" + topic + \" Namesrv return empty\", null);\n                }\n            }\n        } catch (Exception e) {\n            throw new MQClientException(\n                \"Can not find Message Queue for this topic, \" + topic + FAQUrl.suggestTodo(FAQUrl.MQLIST_NOT_EXIST),\n                e);\n        }\n\n        throw new MQClientException(\"Unknown why, Can not find Message Queue for this topic, \" + topic, null);\n    }\n\n    public long searchOffset(MessageQueue mq, long timestamp) throws MQClientException {\n        // default return lower boundary offset when there are more than one offsets.\n        return searchOffset(mq, timestamp, BoundaryType.LOWER);\n    }\n\n    public long searchOffset(MessageQueue mq, long timestamp, BoundaryType boundaryType) throws MQClientException {\n        String brokerAddr = this.mQClientFactory.findBrokerAddressInPublish(this.mQClientFactory.getBrokerNameFromMessageQueue(mq));\n        if (null == brokerAddr) {\n            this.mQClientFactory.updateTopicRouteInfoFromNameServer(mq.getTopic());\n            brokerAddr = this.mQClientFactory.findBrokerAddressInPublish(this.mQClientFactory.getBrokerNameFromMessageQueue(mq));\n        }","sourceCodeStart":163,"sourceCodeEnd":199,"githubUrl":"https://github.com/apache/rocketmq/blob/293f5885719fc4aa3619446a1900f58ccfcfdd29/client/src/main/java/org/apache/rocketmq/client/impl/MQAdminImpl.java#L163-L199","documentation":"The catch branch of fetchSubscribeMessageQueues: an exception during route fetch/conversion (name server timeout, remoting error, TOPIC_NOT_EXIST) is wrapped as MQClientException with a FAQ link (MQLIST_NOT_EXIST). The cause is attached. This is the subscribe-side twin of error [152].","triggerScenarios":"Consumer start or fetchSubscribeMessageQueues(topic) while the name server is unreachable or responds that the topic does not exist.","commonSituations":"Starting a consumer before the topic is created; misconfigured NAMESRV_ADDR; environment where name server ports are blocked.","solutions":["Create the topic or enable auto-creation, then restart/rebalance the consumer","Validate name server address and network reachability from the client","Follow the FAQ link in the message — it enumerates these exact causes"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    consumer.fetchSubscribeMessageQueues(topic);\n} catch (MQClientException e) {\n    // cause holds the remoting/topic-not-exist error; create topic or fix nameserver, then retry\n}","preventionTips":["Bootstrap topics before deploying consumers","Health-check name server reachability in container entrypoints"],"tags":["topic","subscription","nameserver","consumer"],"backgroundTag":null,"analyzedSha":"293f5885719fc4aa3619446a1900f58ccfcfdd29","analyzedAt":"2026-08-14T11:50:13.822Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}