{"record":{"id":"7a082edfa9a2c4a9","repo":"t8y2/dbx","slug":"topic-config-not-found-s","errorCode":null,"errorMessage":"topic config not found: %s","messagePattern":"topic config not found: (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agents/drivers/rocketmq/topics.go","lineNumber":591,"sourceCode":"\treturn wrapper.TopicConfigTable, nil\n}\n\nfunc readTopicConfig(ctx context.Context, address, topic string) (*topicConfigWire, error) {\n\tresponse, err := invokeRemotingWithClient(ctx, address, remoting.NewRequest(remoting.GetTopicConfig, map[string]string{\"topic\": topic}))\n\tif err == nil {\n\t\tvar config topicConfigWire\n\t\tif decodeErr := json.Unmarshal(repairRocketMQJSON(response.Body), &config); decodeErr != nil {\n\t\t\treturn nil, decodeErr\n\t\t}\n\t\treturn &config, nil\n\t}\n\tconfigs, fallbackErr := fetchAllTopicConfigs(ctx, address)\n\tif fallbackErr != nil {\n\t\treturn nil, fmt.Errorf(\"read topic config %s: %v; fallback snapshot: %w\", topic, err, fallbackErr)\n\t}\n\tconfig := configs[topic]\n\tif config == nil {\n\t\treturn nil, fmt.Errorf(\"topic config not found: %s\", topic)\n\t}\n\tif config.TopicName == \"\" {\n\t\tconfig.TopicName = topic\n\t}\n\treturn config, nil\n}\n\nfunc topicAttributesString(attributes map[string]string) string {\n\tkeys := sortedKeys(attributes)\n\tparts := make([]string, 0, len(keys))\n\tfor _, key := range keys {\n\t\tif !strings.HasPrefix(key, \"+\") && !strings.HasPrefix(key, \"-\") {\n\t\t\tcontinue\n\t\t}\n\t\tif attributes[key] == \"\" {\n\t\t\tparts = append(parts, key)\n\t\t} else {\n\t\t\tparts = append(parts, key+\"=\"+attributes[key])","sourceCodeStart":573,"sourceCodeEnd":609,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/rocketmq/topics.go#L573-L609","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nfmt.Printf(\"topic: %s\\n\", os.Getenv(\"TOPIC\")) // TOPIC unset -> empty name\n// after\ntopic := os.Getenv(\"TOPIC\")\nif topic == \"\" {\n    log.Fatal(\"TOPIC must be set to an existing RocketMQ topic\")\n}","handlingStrategy":"validation","validationCode":"// verify the topic exists before calling the driver\nconfigs, err := fetchAllTopicConfigs(ctx, address)\nif err != nil {\n    return fmt.Errorf(\"cannot list topic configs: %w\", err)\n}\nif configs[topic] == nil {\n    return fmt.Errorf(\"topic %q does not exist on cluster; create it or fix the name\", topic)\n}","typeGuard":"func topicConfigExists(configs map[string]*TopicConfig, topic string) bool {\n    return configs != nil && configs[topic] != nil\n}","tryCatchPattern":"config, err := readTopicConfig(ctx, address, topic)\nif err != nil {\n    if strings.HasPrefix(err.Error(), \"topic config not found:\") {\n        // create topic or abort with a clear user-facing message\n        return fmt.Errorf(\"topic %q is not configured on this cluster: %w\", topic, err)\n    }\n    return err\n}","preventionTips":["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."],"tags":["rocketmq","topic-not-found","configuration"],"backgroundTag":"resource-not-found","analyzedSha":"c0390bff16418b651f4728520d99adf8ce48829a","analyzedAt":"2026-09-05T23:05:10.900Z","contentChangedAt":"2026-09-05T23:05:10.900Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}