{"record":{"id":"d5c2493822eaac7b","repo":"t8y2/dbx","slug":"unexpected-management-api-response-for-cluster-ove","errorCode":null,"errorMessage":"Unexpected management API response for cluster overview","messagePattern":"Unexpected management API response for cluster overview","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agents/drivers/rabbitmq/operations.go","lineNumber":1315,"sourceCode":"\t\t\"version\":     serverString(connection.Properties, \"version\"),\n\t\t\"platform\":    serverString(connection.Properties, \"platform\"),\n\t\t\"nodes\":       nodes,\n\t\t\"nodeCount\":   len(nodes),\n\t}, nil\n}\n\nfunc (s *server) getOverview(params jsonObject) (any, error) {\n\tconnection, err := s.requireConnectionConfig(params)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\toverview, err := managementGet(connection, \"/api/overview\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tobject, ok := overview.(map[string]any)\n\tif !ok {\n\t\treturn nil, errors.New(\"Unexpected management API response for cluster overview\")\n\t}\n\treturn overviewInfoFromJSON(jsonObject(object)), nil\n}\n\nfunc overviewInfoFromJSON(overview jsonObject) jsonObject {\n\tinfo := jsonObject{}\n\tputIfPresent(info, \"messagesReady\", nestedLongOrNull(overview, \"queue_totals\", \"messages_ready\"))\n\tputIfPresent(info, \"messagesUnacked\", nestedLongOrNull(overview, \"queue_totals\", \"messages_unacknowledged\"))\n\tif stats := objectOrNil(overview, \"message_stats\"); stats != nil {\n\t\tputIfPresent(info, \"publishRate\", rateFromDetails(stats, \"publish_details\"))\n\t\tputIfPresent(info, \"deliverRate\", rateFromDetails(stats, \"deliver_get_details\"))\n\t\tputIfPresent(info, \"ackRate\", rateFromDetails(stats, \"ack_details\"))\n\t}\n\tputIfPresent(info, \"totalQueues\", nestedLongOrNull(overview, \"object_totals\", \"queues\"))\n\tputIfPresent(info, \"totalExchanges\", nestedLongOrNull(overview, \"object_totals\", \"exchanges\"))\n\tputIfPresent(info, \"totalConnections\", nestedLongOrNull(overview, \"object_totals\", \"connections\"))\n\tputIfPresent(info, \"totalChannels\", nestedLongOrNull(overview, \"object_totals\", \"channels\"))\n\tputIfPresent(info, \"totalConsumers\", nestedLongOrNull(overview, \"object_totals\", \"consumers\"))","sourceCodeStart":1297,"sourceCodeEnd":1333,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/rabbitmq/operations.go#L1297-L1333","documentation":"getOverview calls the RabbitMQ management API GET /api/overview and expects a JSON object. If the response is not a JSON object (unexpected shape), the library throws this error instead of returning malformed data. Usually indicates the endpoint returned an error page, proxy HTML, or an API version/path mismatch.","triggerScenarios":"Management API reachable but /api/overview returned a non-object: HTML error page, string body, JSON array, or empty response.","commonSituations":"Reverse proxy / load balancer intercepting the request; wrong management API port (15672 vs 5672) serving something else; auth error page returned with 200; very old RabbitMQ versions with different response shape.","solutions":["Verify the management URL points to http(s)://host:15672/api and returns JSON (curl it)","Check for proxy/firewall injecting HTML error pages and exclude the management path","Confirm RabbitMQ management plugin version matches the driver's expectations","Check credentials: some auth failures return HTML rather than JSON"],"exampleFix":"// before\nconnection: { url: \"http://localhost:5672\" }   // AMQP port, not management API\n// after\nconnection: { url: \"http://localhost:15672\" }  // management API port","handlingStrategy":"type-guard","validationCode":"const res = await fetch(managementUrl + \"/api/overview\", { headers: authHeader });\nconst ct = res.headers.get(\"content-type\") || \"\";\nif (!ct.includes(\"application/json\")) throw new Error(\"management API not returning JSON\");","typeGuard":"function isOverview(v) { return v != null && typeof v === \"object\" && !Array.isArray(v); }","tryCatchPattern":"try { await agent.dispatch(\"getOverview\", {}); } catch (e) { if (/Unexpected management API response/.test(e.message)) { /* check proxy/URL/credentials before retry */ } else throw e; }","preventionTips":["Point connections at the management port (15672), not the AMQP port","Exclude the management path from HTML-error-page proxies","Test with curl that /api/overview returns JSON","Keep RabbitMQ and driver versions aligned"],"tags":["rabbitmq","management-api","unexpected-response","http"],"backgroundTag":"unexpected-api-response","analyzedSha":"c0390bff16418b651f4728520d99adf8ce48829a","analyzedAt":"2026-09-05T23:05:10.900Z","contentChangedAt":"2026-09-05T23:05:10.900Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}