{"record":{"id":"342f72514f5a4e63","repo":"apache/rocketmq","slug":"can-not-find-message-queue-for-this-topic-topic-342f72","errorCode":null,"errorMessage":"Can not find Message Queue for this topic, ${topic} Namesrv return empty","messagePattern":"Can not find Message Queue for this topic, (.+?) Namesrv return empty","errorType":"exception","errorClass":"MQClientException","httpStatus":null,"severity":"error","filePath":"client/src/main/java/org/apache/rocketmq/client/impl/MQAdminImpl.java","lineNumber":177,"sourceCode":"    public List<MessageQueue> parsePublishMessageQueues(List<MessageQueue> messageQueueList) {\n        List<MessageQueue> resultQueues = new ArrayList<>();\n        for (MessageQueue queue : messageQueueList) {\n            String userTopic = NamespaceUtil.withoutNamespace(queue.getTopic(), this.mQClientFactory.getClientConfig().getNamespace());\n            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));","sourceCodeStart":159,"sourceCodeEnd":195,"githubUrl":"https://github.com/apache/rocketmq/blob/293f5885719fc4aa3619446a1900f58ccfcfdd29/client/src/main/java/org/apache/rocketmq/client/impl/MQAdminImpl.java#L159-L195","documentation":"In fetchSubscribeMessageQueues, the name server returned a non-null TopicRouteData but topicRouteData2TopicSubscribeInfo produced an EMPTY queue set — the route is known yet yields no subscribable queues (queues are filtered out, typically because broker perms exclude read or the route lacks queue metadata). The client throws rather than return an empty set, because subscribing to nothing would silently consume no messages.","triggerScenarios":"Calling defaultMQPushConsumer/fetchSubscribeMessageQueues(topic) (or APIs that seed subscription from route) for a topic whose route yields no readable queues.","commonSituations":"Topic with write-only/read-only perms set opposite to the consumer's need; topic route propagation incomplete right after creation; consumer in a namespace mangling the topic name so the resolved route differs.","solutions":["Run mqadmin topicRoute -t <topic> -n <namesrv> and confirm each broker has read queues (perm includes 2)","Fix perms to 6 (rw) or recreate the topic on the intended brokers","If namespaces are configured, confirm the topic string includes/applies the namespace consistently"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"TopicRouteData route = /* raw route fetch */;\nboolean readable = route != null && route.getQueueDatas().stream()\n    .anyMatch(qd -> org.apache.rocketmq.common.protocol.body.PermName.isReadable(qd.getPerm())\n        && qd.getReadQueueNums() > 0);\nif (!readable) throw new IllegalStateException(\"no readable queues for \" + topic);","typeGuard":null,"tryCatchPattern":"try {\n    consumer.fetchSubscribeMessageQueues(topic);\n} catch (MQClientException e) {\n    if (e.getMessage().contains(\"Namesrv return empty\")) {\n        // route exists but yields no readable queues: fix perms / recreate topic\n    }\n}","preventionTips":["Create topics with read perm for consumers (perm 6)","Apply namespaces consistently between producer and consumer configs"],"tags":["topic","subscription","routing","consumer"],"backgroundTag":null,"analyzedSha":"293f5885719fc4aa3619446a1900f58ccfcfdd29","analyzedAt":"2026-08-14T11:50:13.822Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}