apache/rocketmq · error · MQClientException

No route info for this topic, {}

Error message

No route info for this topic, {}

What it means

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.

Source

Thrown at client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:717

                mq = mQClientFactory.getClientConfig().queueWithNamespace(selector.select(messageQueueList, userMessage, arg));
            } catch (Throwable e) {
                throw new MQClientException("select message queue threw exception.", e);
            }

            long costTime = System.currentTimeMillis() - beginStartTime;
            if (timeout < costTime) {
                throw new RemotingTooMuchRequestException("sendSelectImpl call timeout");
            }
            if (mq != null) {
                return mq;
            } else {
                throw new MQClientException("select message queue return null.", null);
            }
        }

        validateNameServerSetting();
        throw new MQClientException("No route info for this topic, " + msg.getTopic(), null);
    }

    public MessageQueue selectOneMessageQueue(final TopicPublishInfo tpInfo, final String lastBrokerName, final boolean resetIndex) {
        return this.mqFaultStrategy.selectOneMessageQueue(tpInfo, lastBrokerName, resetIndex);
    }

    public void updateFaultItem(final String brokerName, final long currentLatency, boolean isolation,
                                boolean reachable) {
        this.mqFaultStrategy.updateFaultItem(brokerName, currentLatency, isolation, reachable);
    }

    private void validateNameServerSetting() throws MQClientException {
        List<String> nsList = this.getMqClientFactory().getMQClientAPIImpl().getNameServerAddressList();
        if (null == nsList || nsList.isEmpty()) {
            throw new MQClientException(
                "No name server address, please set it." + FAQUrl.suggestTodo(FAQUrl.NAME_SERVER_ADDR_NOT_EXIST_URL), null).setResponseCode(ClientErrorCode.NO_NAME_SERVER_EXCEPTION);
        }

View on GitHub (pinned to 293f588571)

Solutions

  1. Create the topic explicitly: mqadmin updateTopic -n <namesrv> -c <cluster> -t <topic>, or via console/dashboard; verify with mqadmin topicRoute -t <topic>
  2. If intentional, enable auto topic creation (broker: autoCreateTopicEnable=true, and ensure TBW102 default topic exists) - not recommended for prod
  3. Double-check producer.setNamesrvAddr points at the cluster where the topic lives, and fix typos/namespace prefixes in the topic string
  4. For just-created topics, retry after a few seconds or pre-create routes at deploy time so producers don't race topic creation

Example fix

// before
producer.send(msg, selector, arg); // topic 'order-event' never created
// after
// shell: sh mqadmin updateTopic -n 10.0.0.1:9876 -c DefaultCluster -t order-event
producer.send(msg, selector, arg);
Defensive patterns

Strategy: validation

Validate before calling

 // pre-flight: topic must have a route
TopicRouteData route = producer.getDefaultMQProducerImpl().getMqClientFactory().getMQClientAPIImpl()
        .getTopicRouteInfoFromNameServer(topic, 3000);
if (route == null || route.getQueueDatas().isEmpty()) {
    throw new ConfigurationException("Topic " + topic + " has no route; create it before sending");
}

Try / catch

try {
    producer.send(msg, selector, arg);
} catch (MQClientException e) {
    if (e.getMessage() != null && e.getMessage().contains("No route info for this topic")) {
        throw new TopicMissingException(topic, e); // surface as config error, not transient
    }
    throw e;
}

Prevention

When it happens

Trigger: triggerScenarios

Common situations: commonSituations

Related errors


AI-assisted analysis of apache/rocketmq@293f588571 (2026-08-14). Data as JSON: /api/errors/e3c924eb8be21f09. Report an issue: GitHub.