t8y2/dbx · error
Unexpected management API response for node listing
Error message
Unexpected management API response for node listing
What it means
listNodes calls GET /api/nodes and expects a JSON array of node objects. If the response is not an array, the library throws this error. This protects callers from processing a malformed or unexpected management API response (e.g. an error object instead of the node list).
Source
Thrown at agents/drivers/rabbitmq/operations.go:1348
putIfPresent(info, "totalExchanges", nestedLongOrNull(overview, "object_totals", "exchanges"))
putIfPresent(info, "totalConnections", nestedLongOrNull(overview, "object_totals", "connections"))
putIfPresent(info, "totalChannels", nestedLongOrNull(overview, "object_totals", "channels"))
putIfPresent(info, "totalConsumers", nestedLongOrNull(overview, "object_totals", "consumers"))
return info
}
func (s *server) listNodes(params jsonObject) (any, error) {
connection, err := s.requireConnectionConfig(params)
if err != nil {
return nil, err
}
nodes, err := managementGet(connection, "/api/nodes")
if err != nil {
return nil, err
}
array, ok := nodes.([]any)
if !ok {
return nil, errors.New("Unexpected management API response for node listing")
}
result := make([]jsonObject, 0, len(array))
for _, value := range array {
node, ok := value.(map[string]any)
if ok {
result = append(result, nodeInfoFromJSON(jsonObject(node)))
}
}
sort.SliceStable(result, func(left, right int) bool {
return stringOrEmpty(result[left], "name") < stringOrEmpty(result[right], "name")
})
return jsonObject{"nodes": result}, nil
}
func nodeInfoFromJSON(node jsonObject) jsonObject {
info := jsonObject{
"name": stringOrEmpty(node, "name"),
"running": boolOrDefault(node, "running", false),View on GitHub (pinned to c0390bff16)
Solutions
- curl -u user:pass http://host:15672/api/nodes and confirm the body is a JSON array
- Check credentials and that the response is not an auth/error object
- Verify the management plugin is enabled (rabbitmq-plugins enable rabbitmq_management)
- Upgrade/align driver with the RabbitMQ server version
Defensive patterns
Strategy: type-guard
Validate before calling
const res = await fetch(managementUrl + "/api/nodes", { headers: authHeader });
const body = await res.json();
if (!Array.isArray(body)) throw new Error("/api/nodes did not return an array"); Type guard
function isNodeList(v) { return Array.isArray(v) && v.every(n => n != null && typeof n === "object"); } Try / catch
try { await agent.dispatch("listNodes", {}); } catch (e) { if (/Unexpected management API response/.test(e.message)) { /* verify /api/nodes returns a JSON array */ } else throw e; } Prevention
- Verify /api/nodes with curl before automating
- Ensure the management plugin is enabled
- Check for auth middleware returning error objects
- Pin compatible RabbitMQ/driver versions
When it happens
Trigger: Management API returns a JSON object (e.g. {"error":"..."}) or scalar instead of an array for /api/nodes.
Common situations: Proxy returning an error object; authentication failure producing a non-array body; management plugin version mismatch changing the response envelope; hitting the wrong endpoint path.
Related errors
- Unexpected management API response for cluster overview
- Unexpected management API response for queue details
- Unexpected management API response for vhost listing
- Unexpected management API response for permission listing
- Unexpected management API response for list endpoint %s
AI-assisted analysis of t8y2/dbx@c0390bff16 (2026-09-05).
Data as JSON: /api/errors/50840d710a9a1385.
Report an issue: GitHub.