t8y2/dbx · error
Invalid exchange type '%s'. Supported types: direct, fanout,
Error message
Invalid exchange type '%s'. Supported types: direct, fanout, topic, headers
What it means
RabbitMQ only supports four exchange types: direct, fanout, topic, and headers. validateExchangeType rejects anything else before sending the exchange.declare frame to the broker, which itself would reject it.
Source
Thrown at agents/drivers/rabbitmq/operations.go:477
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")
}
return name, nil
}
func validateExchangeType(exchangeType string) (string, error) {
if _, ok := exchangeTypes[exchangeType]; !ok {
return "", fmt.Errorf("Invalid exchange type '%s'. Supported types: direct, fanout, topic, headers", exchangeType)
}
return exchangeType, nil
}
func assertExchangeDeletable(name string) error {
if name == "" {
return errors.New("The default exchange cannot be deleted")
}
if strings.HasPrefix(name, "amq.") {
return fmt.Errorf("The built-in exchange '%s' cannot be deleted", name)
}
return nil
}
func (s *server) listBindings(params jsonObject) (any, error) {
connection, err := s.requireConnectionConfig(params)
if err != nil {
return nil, errView on GitHub (pinned to c0390bff16)
Solutions
- Use one of: direct, fanout, topic, headers
- Fix typos and surrounding whitespace in the exchange type value
- If a plugin exchange type is genuinely needed, install the plugin and use the broker's own tooling — this driver does not support it
Example fix
// before
await client.createExchange({"name": "events", "type": "topicx"})
// after
await client.createExchange({"name": "events", "type": "topic"}) Defensive patterns
Strategy: validation
Validate before calling
const EXCHANGE_TYPES = new Set(["direct", "fanout", "topic", "headers"])
function validExchangeType(t) { return EXCHANGE_TYPES.has(t) } Type guard
function isExchangeType(v) {
return typeof v === "string" && ["direct","fanout","topic","headers"].includes(v)
} Prevention
- Validate exchange type against the enum at input boundaries
- Trim and lowercase user-provided type strings before calling
- Never assume plugin exchange types are supported by this driver
When it happens
Trigger: Calling createExchange with a type such as 'directx', 'topic ', 'x-consistent-hash' (a plugin type), or any misspelling of the four supported types.
Common situations: Typos in tooling/UI input, copying exchange types from other brokers (Kafka topics, ActiveMQ), or trying plugin exchange types without the plugin installed.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- name is required
- topic (queue name) is required
- all_vhosts is only supported for list operations
- namespace is required
- namespace create/delete requires a specific virtual host (al
AI-assisted analysis of t8y2/dbx@c0390bff16 (2026-09-05).
Data as JSON: /api/errors/372f95690d75ad54.
Report an issue: GitHub.