{"record":{"id":"e3c924eb8be21f09","repo":"apache/rocketmq","slug":"no-route-info-for-this-topic","errorCode":null,"errorMessage":"No route info for this topic, {}","messagePattern":"No route info for this topic, (.+?)","errorType":"exception","errorClass":"MQClientException","httpStatus":null,"severity":"error","filePath":"client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java","lineNumber":717,"sourceCode":"\n                mq = mQClientFactory.getClientConfig().queueWithNamespace(selector.select(messageQueueList, userMessage, arg));\n            } catch (Throwable e) {\n                throw new MQClientException(\"select message queue threw exception.\", e);\n            }\n\n            long costTime = System.currentTimeMillis() - beginStartTime;\n            if (timeout < costTime) {\n                throw new RemotingTooMuchRequestException(\"sendSelectImpl call timeout\");\n            }\n            if (mq != null) {\n                return mq;\n            } else {\n                throw new MQClientException(\"select message queue return null.\", null);\n            }\n        }\n\n        validateNameServerSetting();\n        throw new MQClientException(\"No route info for this topic, \" + msg.getTopic(), null);\n    }\n\n    public MessageQueue selectOneMessageQueue(final TopicPublishInfo tpInfo, final String lastBrokerName, final boolean resetIndex) {\n        return this.mqFaultStrategy.selectOneMessageQueue(tpInfo, lastBrokerName, resetIndex);\n    }\n\n    public void updateFaultItem(final String brokerName, final long currentLatency, boolean isolation,\n                                boolean reachable) {\n        this.mqFaultStrategy.updateFaultItem(brokerName, currentLatency, isolation, reachable);\n    }\n\n    private void validateNameServerSetting() throws MQClientException {\n        List<String> nsList = this.getMqClientFactory().getMQClientAPIImpl().getNameServerAddressList();\n        if (null == nsList || nsList.isEmpty()) {\n            throw new MQClientException(\n                \"No name server address, please set it.\" + FAQUrl.suggestTodo(FAQUrl.NAME_SERVER_ADDR_NOT_EXIST_URL), null).setResponseCode(ClientErrorCode.NO_NAME_SERVER_EXCEPTION);\n        }\n","sourceCodeStart":699,"sourceCodeEnd":735,"githubUrl":"https://github.com/apache/rocketmq/blob/293f5885719fc4aa3619446a1900f58ccfcfdd29/client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java#L699-L735","documentation":"MQClientException (from the send-select path) meaning the topic had no usable route after lookup: tryToFindTopicPublishInfo returned null/not-ok, so invokeMessageQueueSelector falls through to validateNameServerSetting() (which passed - the name server IS reachable) and then throws 'No route info for this topic'. Route info comes from the name server; if it never heard of the topic, the client cannot pick a queue or a broker.","triggerScenarios":"triggerScenarios","commonSituations":"commonSituations","solutions":["Create the topic explicitly: mqadmin updateTopic -n <namesrv> -c <cluster> -t <topic>, or via console/dashboard; verify with mqadmin topicRoute -t <topic>","If intentional, enable auto topic creation (broker: autoCreateTopicEnable=true, and ensure TBW102 default topic exists) - not recommended for prod","Double-check producer.setNamesrvAddr points at the cluster where the topic lives, and fix typos/namespace prefixes in the topic string","For just-created topics, retry after a few seconds or pre-create routes at deploy time so producers don't race topic creation"],"exampleFix":"// before\nproducer.send(msg, selector, arg); // topic 'order-event' never created\n// after\n// shell: sh mqadmin updateTopic -n 10.0.0.1:9876 -c DefaultCluster -t order-event\nproducer.send(msg, selector, arg);","handlingStrategy":"validation","validationCode":" // pre-flight: topic must have a route\nTopicRouteData route = producer.getDefaultMQProducerImpl().getMqClientFactory().getMQClientAPIImpl()\n        .getTopicRouteInfoFromNameServer(topic, 3000);\nif (route == null || route.getQueueDatas().isEmpty()) {\n    throw new ConfigurationException(\"Topic \" + topic + \" has no route; create it before sending\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    producer.send(msg, selector, arg);\n} catch (MQClientException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"No route info for this topic\")) {\n        throw new TopicMissingException(topic, e); // surface as config error, not transient\n    }\n    throw e;\n}","preventionTips":["Provision topics in the deploy pipeline (mqadmin updateTopic) before producers start","Verify producer nameserver points at the cluster that owns the topic","Assert topic constants in a shared module to prevent typos","Treat 'no route' as a distinct, alertable config error class in send wrappers"],"tags":["rocketmq","producer","routing","topic-not-found"],"backgroundTag":null,"analyzedSha":"293f5885719fc4aa3619446a1900f58ccfcfdd29","analyzedAt":"2026-08-14T11:50:13.822Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}