t8y2/dbx · error

all_vhosts is only supported for list operations

Error message

all_vhosts is only supported for list operations

What it means

When the request params enable all_vhosts mode, only list-style methods may use it; the driver rejects non-list methods before dispatching. This prevents applying a single operation across every vhost, which the underlying management APIs don't support per-method.

Source

Thrown at agents/drivers/rabbitmq/main.go:143

			response.Error = &rpcError{Code: -1, Message: normalizeErrorMessage(err)}
			return response, false
		}
		if object, ok := decoded.(map[string]any); ok {
			params = jsonObject(object)
		}
	}
	result, shutdown, err := s.dispatch(request.Method, params)
	if err != nil {
		response.Error = &rpcError{Code: -1, Message: normalizeErrorMessage(err)}
		return response, false
	}
	response.Result = result
	return response, shutdown
}

func (s *server) dispatch(method string, params jsonObject) (any, bool, error) {
	if _, unsupported := allVhostsUnsupportedMethods[method]; unsupported && allVhostsRequested(params) {
		return nil, false, errors.New("all_vhosts is only supported for list operations")
	}
	switch method {
	case "handshake":
		return handshakeResult{protocolVersion, agentProtocolVersion, capabilities}, false, nil
	case "connect":
		result, err := s.connect(params)
		return result, false, err
	case "test_connection":
		result, err := s.testConnection(params)
		return result, false, err
	case "disconnect":
		s.closeClients()
		return okResult(), false, nil
	case "shutdown":
		s.closeClients()
		return okResult(), true, nil
	case "mq_list_topics":
		result, err := s.listTopics(params)

View on GitHub (pinned to c0390bff16)

Solutions

  1. Remove the all_vhosts flag from non-list method calls
  2. Loop over vhosts yourself and issue one call per vhost with an explicit virtual_host
  3. Use all_vhosts only with list operations

Example fix

// before
agent.Call("mq_purge_queue", map[string]any{"topic": "q", "all_vhosts": true})
// after
agent.Call("mq_purge_queue", map[string]any{"topic": "q", "virtual_host": "prod"})
Defensive patterns

Strategy: validation

Validate before calling

if allVhosts, ok := params["all_vhosts"]; ok && allVhosts == true && !strings.Contains(method, "list") {
	delete(params, "all_vhosts")
}

Type guard

func isListMethod(method string) bool {
	return strings.HasPrefix(method, "mq_list")
}

Try / catch

result, err := agent.Call(method, params)
if err != nil && strings.Contains(err.Error(), "all_vhosts is only supported for list operations") {
	delete(params, "all_vhosts")
	result, err = agent.Call(method, params) // retry scoped to one vhost
}

Prevention

When it happens

Trigger: Calling any method in allVhostsUnsupportedMethods (e.g. connect, purge_queue, create/delete topic) with params where allVhostsRequested(params) is true (all_vhosts set/enabled).

Common situations: A shared request builder that always sets all_vhosts=true for every call; copying a list-topics request and changing only the method name; misconfigured agent policies enabling all-vhost mode globally.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of t8y2/dbx@c0390bff16 (2026-09-05). Data as JSON: /api/errors/cd43730e556cbca4. Report an issue: GitHub.