t8y2/dbx · error
name is required
Error message
name is required
What it means
deleteExchange validates that an exchange 'name' was provided before issuing the DELETE /api/exchanges request. This error is thrown when the name is missing or whitespace-only. Note assertExchangeDeletable runs first, so blank names surface as whichever guard fires; the driver still requires a concrete exchange name.
Source
Thrown at agents/drivers/rabbitmq/operations.go:453
body := jsonObject{
"type": exchangeType,
"durable": boolOrDefault(params, "durable", true),
"auto_delete": boolOrDefault(params, "autoDelete", false),
}
if _, err := managementSend(connection, http.MethodPut,
"/api/exchanges/"+urlEncodeVhost(vhost)+"/"+urlEncodePathSegment(name), body); err != nil {
return nil, err
}
return okResult(), nil
}
func (s *server) deleteExchange(params jsonObject) (any, error) {
name := stringOrEmpty(params, "name")
if err := assertExchangeDeletable(name); err != nil {
return nil, err
}
if strings.TrimSpace(name) == "" {
return nil, errors.New("name is required")
}
connection, err := s.requireConnectionConfig(params)
if err != nil {
return nil, err
}
vhost := effectiveVhost(params, connection)
if _, err := managementSend(connection, http.MethodDelete,
"/api/exchanges/"+urlEncodeVhost(vhost)+"/"+urlEncodePathSegment(name), nil); err != nil {
return nil, err
}
return okResult(), nil
}
func exchangeName(params jsonObject) (string, error) {
name := stringOrEmpty(params, "name")
if strings.TrimSpace(name) == "" {
return "", errors.New("name is required")
}View on GitHub (pinned to c0390bff16)
Solutions
- Pass {"name": "my-exchange"} (and, if needed, 'vhost' and 'destinationType' per your driver's contract) when calling deleteExchange.
- Validate non-empty name at the call site before invoking the driver.
- Confirm you are using the parameter name the dispatch contract expects — inspect the dispatch switch in operations.go for the accepted keys.
Example fix
// before
server.Call("deleteExchange", map[string]any{"exchange": "logs"})
// after
server.Call("deleteExchange", map[string]any{"name": "logs"}) Defensive patterns
Strategy: validation
Validate before calling
func requireExchangeName(params map[string]any) error {
name, _ := params["name"].(string)
if strings.TrimSpace(name) == "" {
return errors.New("caller validation: deleteExchange requires a non-empty 'name'")
}
return nil
} Type guard
func hasExchangeName(params map[string]any) bool {
name, ok := params["name"].(string)
return ok && strings.TrimSpace(name) != ""
} Try / catch
_, err := server.Call("deleteExchange", params)
if err != nil {
if err.Error() == "name is required" {
return fmt.Errorf("deleteExchange requires params.name; got %v", params["name"])
}
return err
} Prevention
- Use the exact key 'name' when calling deleteExchange.
- Normalize exchange records so the name field is always populated before deletion.
- Skip or log entries with empty names instead of passing them through.
- Add a shared params validator for all delete* operations in your calling code.
When it happens
Trigger: Calling deleteExchange without params["name"], or with name:"" or " ", on a connected RabbitMQ server instance.
Common situations: Deleting exchanges from a list where an entry lacked a name field; UI passing an empty selection; confusable param names ('exchange' vs 'name'); copy-paste from deleteQueue examples missing the key.
Understand the failure class
Background: Missing required parameter errors: what 'X is required' and 'the required X param is missing' mean, and how to fix them — this error's family across 27 libraries.
Related errors
- topic (queue name) is required
- namespace is required
- password is required
- Invalid exchange type '%s'. Supported types: direct, fanout,
- %s is required
AI-assisted analysis of t8y2/dbx@c0390bff16 (2026-09-05).
Data as JSON: /api/errors/ece39ff8024f843b.
Report an issue: GitHub.