t8y2/dbx · error
topic config not found: %s
Error message
topic config not found: %s
What it means
readTopicConfig in the RocketMQ driver fails to resolve a topic's configuration. After the primary lookup fails and a full snapshot fetch via fetchAllTopicConfigs succeeds, the topic is still absent from the returned config map, so the driver returns this error. It means the topic genuinely has no stored config on the queried broker/name-server, not that the fetch itself failed.
Source
Thrown at agents/drivers/rocketmq/topics.go:591
return wrapper.TopicConfigTable, nil
}
func readTopicConfig(ctx context.Context, address, topic string) (*topicConfigWire, error) {
response, err := invokeRemotingWithClient(ctx, address, remoting.NewRequest(remoting.GetTopicConfig, map[string]string{"topic": topic}))
if err == nil {
var config topicConfigWire
if decodeErr := json.Unmarshal(repairRocketMQJSON(response.Body), &config); decodeErr != nil {
return nil, decodeErr
}
return &config, nil
}
configs, fallbackErr := fetchAllTopicConfigs(ctx, address)
if fallbackErr != nil {
return nil, fmt.Errorf("read topic config %s: %v; fallback snapshot: %w", topic, err, fallbackErr)
}
config := configs[topic]
if config == nil {
return nil, fmt.Errorf("topic config not found: %s", topic)
}
if config.TopicName == "" {
config.TopicName = topic
}
return config, nil
}
func topicAttributesString(attributes map[string]string) string {
keys := sortedKeys(attributes)
parts := make([]string, 0, len(keys))
for _, key := range keys {
if !strings.HasPrefix(key, "+") && !strings.HasPrefix(key, "-") {
continue
}
if attributes[key] == "" {
parts = append(parts, key)
} else {
parts = append(parts, key+"="+attributes[key])View on GitHub (pinned to c0390bff16)
Solutions
- Verify the topic exists: run `mqadmin topicStatus -t <topic>` or check the RocketMQ dashboard for the exact topic name on the cluster at the configured address.
- Fix the topic name spelling/case passed to getTopicConfig/updatePartitions/alterTopicConfig.
- Create the missing topic with `mqadmin updateTopic -n <namesrv> -t <topic> -r <readQueues> -w <writeQueues>` before calling the driver again.
- Confirm the driver is pointed at the correct cluster (address config) — the topic may exist on a different cluster.
Example fix
// before
fmt.Printf("topic: %s\n", os.Getenv("TOPIC")) // TOPIC unset -> empty name
// after
topic := os.Getenv("TOPIC")
if topic == "" {
log.Fatal("TOPIC must be set to an existing RocketMQ topic")
} Defensive patterns
Strategy: validation
Validate before calling
// verify the topic exists before calling the driver
configs, err := fetchAllTopicConfigs(ctx, address)
if err != nil {
return fmt.Errorf("cannot list topic configs: %w", err)
}
if configs[topic] == nil {
return fmt.Errorf("topic %q does not exist on cluster; create it or fix the name", topic)
} Type guard
func topicConfigExists(configs map[string]*TopicConfig, topic string) bool {
return configs != nil && configs[topic] != nil
} Try / catch
config, err := readTopicConfig(ctx, address, topic)
if err != nil {
if strings.HasPrefix(err.Error(), "topic config not found:") {
// create topic or abort with a clear user-facing message
return fmt.Errorf("topic %q is not configured on this cluster: %w", topic, err)
}
return err
} Prevention
- Validate topic names against the cluster snapshot at startup and fail fast.
- Use one shared constant/config source for topic names to avoid typos.
- Create topics declaratively (mqadmin/IaC) before deploying consumers/producers.
- Pin the driver's address config to the intended cluster per environment.
When it happens
Trigger: Calling updatePartitions, getTopicConfig, or alterTopicConfig with a topic name that does not exist on the broker; mistyped or case-mismatched topic name; topic was deleted between listing and reading; querying the wrong cluster/address whose snapshot lacks the topic.
Common situations: Typos in topic names in config files or environment variables; environments (staging vs prod) where the topic was never created; auto-created topics disabled on the broker so a producer-side topic name never materializes; stale clients after a topic rename or deletion.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- Agent runtime thread limits must be positive
- H2 JDBC driver rejected URL: " + buildJdbcUrl(params)
- Custom H2 driver profile requires at least one JDBC JAR path
- Unsupported H2 driver profile: " + profile
- Informix metadata owner is unavailable for an unqualified re
AI-assisted analysis of t8y2/dbx@c0390bff16 (2026-09-05).
Data as JSON: /api/errors/7a082edfa9a2c4a9.
Report an issue: GitHub.