{"record":{"id":"ccc75127f1719663","repo":"t8y2/dbx","slug":"topic-queue-name-is-required","errorCode":null,"errorMessage":"topic (queue name) is required","messagePattern":"topic \\(queue name\\) is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agents/drivers/rabbitmq/helpers.go","lineNumber":340,"sourceCode":"\t\treturn nil, errors.New(\"Not connected. Call connect first.\")\n\t}\n\treturn connection, nil\n}\n\nfunc (s *server) requireConnection() (*amqp.Connection, error) {\n\tif s.connection == nil {\n\t\treturn nil, errors.New(\"Not connected. Call connect first.\")\n\t}\n\treturn s.connection, nil\n}\n\nfunc queueName(params jsonObject) (string, error) {\n\tname := stringOrEmpty(params, \"topic\")\n\tif strings.TrimSpace(name) == \"\" {\n\t\tname = stringOrEmpty(params, \"name\")\n\t}\n\tif strings.TrimSpace(name) == \"\" {\n\t\treturn \"\", errors.New(\"topic (queue name) is required\")\n\t}\n\treturn name, nil\n}\n\nfunc effectiveVhost(params, connection jsonObject) string {\n\tvhost := stringOrNull(params, \"virtual_host\")\n\tif vhost == nil || strings.TrimSpace(*vhost) == \"\" {\n\t\tif connection != nil {\n\t\t\treturn stringOrDefault(connection, \"virtual_host\", \"/\")\n\t\t}\n\t\treturn \"/\"\n\t}\n\treturn *vhost\n}\n\nfunc allVhostsRequested(params jsonObject) bool {\n\treturn boolOrDefault(params, \"all_vhosts\", false)\n}","sourceCodeStart":322,"sourceCodeEnd":358,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/rabbitmq/helpers.go#L322-L358","documentation":"queueName resolves the target queue from the 'topic' parameter, falling back to 'name'. If both are empty or whitespace, the driver cannot identify which queue to operate on and throws this error. It guards all queue-scoped operations (create/delete/stats/config/purge).","triggerScenarios":"Calling mq_create_topic, mq_delete_topic, mq_get_topic_stats, mq_get_topic_config, or mq_purge_queue with params lacking both 'topic' and 'name', or with a value that is empty or only whitespace (e.g. topic: \"\").","commonSituations":"Config files where the topic key is misspelled ('queue' instead of 'topic'); templated configs where an env var like TOPIC_NAME is unset; building params programmatically and leaving the field blank.","solutions":["Add a non-empty 'topic' parameter to the call","Or supply 'name' with the queue name as a fallback","Check that the config/env var feeding the topic value is actually set and not whitespace"],"exampleFix":"// before\nresult := agent.Call(\"mq_purge_queue\", map[string]any{\"topic\": \"\"})\n// after\nresult := agent.Call(\"mq_purge_queue\", map[string]any{\"topic\": \"orders-queue\"})","handlingStrategy":"validation","validationCode":"topic := strings.TrimSpace(params[\"topic\"])\nif topic == \"\" { topic = strings.TrimSpace(params[\"name\"]) }\nif topic == \"\" { return errors.New(\"call requires a non-empty 'topic' (or 'name')\") }","typeGuard":"func hasTopic(params map[string]any) bool {\n\ts, _ := params[\"topic\"].(string)\n\tif strings.TrimSpace(s) == \"\" { s, _ = params[\"name\"].(string) }\n\treturn strings.TrimSpace(s) != \"\"\n}","tryCatchPattern":"result, err := agent.Call(\"mq_purge_queue\", params)\nif err != nil && strings.Contains(err.Error(), \"topic (queue name) is required\") {\n\treturn fmt.Errorf(\"config error: queue/topic name missing in %v\", params)\n}","preventionTips":["Always set 'topic' explicitly in queue-scoped calls","Centralize queue name resolution in one config helper","Fail fast at startup if the configured queue name is blank"],"tags":["rabbitmq","validation","missing-parameter"],"backgroundTag":"missing-required-parameter","analyzedSha":"c0390bff16418b651f4728520d99adf8ce48829a","analyzedAt":"2026-09-05T23:05:10.900Z","contentChangedAt":"2026-09-05T23:05:10.900Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}