{"record":{"id":"3684c041dcf9d7cd","repo":"apache/rocketmq","slug":"unknown-why-can-not-find-message-queue-for-this-t","errorCode":null,"errorMessage":"Unknown why, Can not find Message Queue for this topic, ${topic}","messagePattern":"Unknown why, Can not find Message Queue for this topic, (.+?)","errorType":"exception","errorClass":"MQClientException","httpStatus":null,"severity":"error","filePath":"client/src/main/java/org/apache/rocketmq/client/impl/MQAdminImpl.java","lineNumber":156,"sourceCode":"        } catch (Exception e) {\n            throw new MQClientException(\"create new topic failed\", e);\n        }\n    }\n\n    public List<MessageQueue> fetchPublishMessageQueues(String topic) throws MQClientException {\n        try {\n            TopicRouteData topicRouteData = this.mQClientFactory.getMQClientAPIImpl().getTopicRouteInfoFromNameServer(topic, timeoutMillis);\n            if (topicRouteData != null) {\n                TopicPublishInfo topicPublishInfo = MQClientInstance.topicRouteData2TopicPublishInfo(topic, topicRouteData);\n                if (topicPublishInfo != null && topicPublishInfo.ok()) {\n                    return parsePublishMessageQueues(topicPublishInfo.getMessageQueueList());\n                }\n            }\n        } catch (Exception e) {\n            throw new MQClientException(\"Can not find Message Queue for this topic, \" + topic, e);\n        }\n\n        throw new MQClientException(\"Unknown why, Can not find Message Queue for this topic, \" + topic, null);\n    }\n\n    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()) {","sourceCodeStart":138,"sourceCodeEnd":174,"githubUrl":"https://github.com/apache/rocketmq/blob/293f5885719fc4aa3619446a1900f58ccfcfdd29/client/src/main/java/org/apache/rocketmq/client/impl/MQAdminImpl.java#L138-L174","documentation":"Fall-through case of fetchPublishMessageQueues: the name server returned a route without throwing, but it was null or produced a TopicPublishInfo that is not ok() (no writable queues for this client). Since no exception explains it, the client reports 'Unknown why'. In practice it means the route exists but contains no queues this producer can publish to (e.g. perm rejects write, or route lacks queue data).","triggerScenarios":"fetchPublishMessageQueues(topic) where the topic route has zero write queues or the topic exists only on brokers whose perm is read-only (perm=2/3).","commonSituations":"Topic created with read-only permission; partial route during broker registration; comparing envs where the topic exists in one cluster and not the other.","solutions":["Inspect the topic's route and perms: mqadmin topicRoute -t <topic> -n <namesrv> and update to perm 6 if read-only","Recreate/extend the topic with explicit queue nums on all target brokers","Verify you point at the correct cluster/name server for this topic"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"TopicRouteData route = /* raw route fetch */;\nboolean writable = route != null && route.getQueueDatas().stream()\n    .anyMatch(qd -> org.apache.rocketmq.common.protocol.body.PermName.isWriteable(qd.getPerm())\n        && qd.getReadQueueNums() >= 0);\nif (!writable) throw new IllegalStateException(\"no writable queues for \" + topic);","typeGuard":null,"tryCatchPattern":"try {\n    producer.fetchPublishMessageQueues(topic);\n} catch (MQClientException e) {\n    if (e.getMessage().startsWith(\"Unknown why\")) {\n        // inspect mqadmin topicRoute; check perms and queue nums\n    }\n}","preventionTips":["Create topics with explicit perm 6 and queue counts","Monitor topic route changes (perm flips) in production"],"tags":["topic","admin","routing","permissions"],"backgroundTag":null,"analyzedSha":"293f5885719fc4aa3619446a1900f58ccfcfdd29","analyzedAt":"2026-08-14T11:50:13.822Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}