apache/rocketmq · error · MQClientException
NOT_FOUND_TOPIC_EXCEPTION
NOT_FOUND_TOPIC_EXCEPTION
Error message
No route info of this topic: {} What it means
MQClientException with responseCode ClientErrorCode.NOT_FOUND_TOPIC_EXCEPTION thrown at the tail of sendDefaultImpl: the send loop could not run at all because tryToFindTopicPublishInfo produced no usable TopicPublishInfo, the name server setting passed validation, so the only remaining cause is that the name server knows no route for this topic. Response code NOT_FOUND_TOPIC_EXCEPTION (and the FAQ link) let tooling distinguish missing-topic from other send failures. Same root cause as error 270 but on the plain send() path.
Source
Thrown at client/src/main/java/org/apache/rocketmq/client/impl/producer/DefaultMQProducerImpl.java:890
throw new RemotingTooMuchRequestException("sendDefaultImpl call timeout");
}
if (exception instanceof MQBrokerException) {
mqClientException.setResponseCode(((MQBrokerException) exception).getResponseCode());
} else if (exception instanceof RemotingConnectException) {
mqClientException.setResponseCode(ClientErrorCode.CONNECT_BROKER_EXCEPTION);
} else if (exception instanceof RemotingTimeoutException) {
mqClientException.setResponseCode(ClientErrorCode.ACCESS_BROKER_TIMEOUT);
} else if (exception instanceof MQClientException) {
mqClientException.setResponseCode(ClientErrorCode.BROKER_NOT_EXIST_EXCEPTION);
}
throw mqClientException;
}
validateNameServerSetting();
throw new MQClientException("No route info of this topic: " + msg.getTopic() + FAQUrl.suggestTodo(FAQUrl.NO_TOPIC_ROUTE_INFO),
null).setResponseCode(ClientErrorCode.NOT_FOUND_TOPIC_EXCEPTION);
}
private TopicPublishInfo tryToFindTopicPublishInfo(final String topic) {
TopicPublishInfo topicPublishInfo = this.topicPublishInfoTable.get(topic);
if (null == topicPublishInfo || !topicPublishInfo.ok()) {
this.topicPublishInfoTable.putIfAbsent(topic, new TopicPublishInfo());
this.mQClientFactory.updateTopicRouteInfoFromNameServer(topic);
topicPublishInfo = this.topicPublishInfoTable.get(topic);
}
if (topicPublishInfo.isHaveTopicRouterInfo() || topicPublishInfo.ok()) {
return topicPublishInfo;
} else {
this.mQClientFactory.updateTopicRouteInfoFromNameServer(topic, true, this.defaultMQProducer);
topicPublishInfo = this.topicPublishInfoTable.get(topic);
return topicPublishInfo;
}View on GitHub (pinned to 293f588571)
Solutions
- Pre-create the topic: sh mqadmin updateTopic -n <namesrv> -c <cluster> -t <topic>; verify with topicList/topicRoute and check the producer's nameserver matches
- If auto-creation is acceptable, set broker autoCreateTopicEnable=true and ensure the TBW102 default topic exists
- Fix the topic string: correct typos, apply the right namespace (producer.setNamespace) or strip it where unintended
- Retry/schedule sends for just-created topics, or bootstrap topic creation in deployment scripts before producers start
Example fix
// before
Message msg = new Message("order-events", body); // topic does not exist
producer.send(msg);
// after
// ops: sh mqadmin updateTopic -n 10.0.0.1:9876 -c DefaultCluster -t order-events
Message msg = new Message("order-events", body);
producer.send(msg); Defensive patterns
Strategy: try-catch
Validate before calling
// fail fast at startup for known topics
for (String topic : requiredTopics) {
producer.createTopic(key, topic, 8); // or check route and throw with topic name
} Try / catch
try {
producer.send(msg);
} catch (MQClientException e) {
if (e.getResponseCode() == ClientErrorCode.NOT_FOUND_TOPIC_EXCEPTION) {
alertOps("topic missing: " + msg.getTopic()); // provisioning problem, do not blind-retry
}
throw e;
} Prevention
- Create topics as part of infrastructure-as-code, not at runtime
- Run a startup probe: fetch route for each required topic, fail deployment if missing
- Match nameserver config per environment explicitly (dev/stage/prod)
- Handle NOT_FOUND_TOPIC_EXCEPTION by response code and treat it as non-retryable config error
When it happens
Trigger: triggerScenarios
Common situations: commonSituations
Related errors
- No route info for this topic, {}
- The broker[{}] not exist
- 13
- Sending message to topic[%s] is forbidden.
- 17
AI-assisted analysis of apache/rocketmq@293f588571 (2026-08-14).
Data as JSON: /api/errors/0713dd1042b2f25a.
Report an issue: GitHub.