{"record":{"id":"23abc565cc97bb79","repo":"louislam/uptime-kuma","slug":"res-data-reason","errorCode":null,"errorMessage":"${res.data.reason}","messagePattern":"\\$\\{res\\.data\\.reason\\}","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"server/monitor-types/rabbitmq.js","lineNumber":95,"sourceCode":"            signal: axiosAbortSignal((monitor.timeout + 10) * 1000),\n            // Capture reason for 503 status\n            validateStatus: (status) => status === 200 || status === 503,\n        };\n\n        log.debug(\"monitor\", `[${monitor.name}] Checking node ${nodeInfo}: ${baseUrl}`);\n\n        try {\n            const res = await axios.request(options);\n            log.debug(\n                \"monitor\",\n                `[${monitor.name}] Axios Response: status=${res.status} body=${JSON.stringify(res.data)}`\n            );\n\n            if (res.status === 200) {\n                log.debug(\"monitor\", `[${monitor.name}] Node ${nodeInfo} is healthy`);\n                // Success - return without error\n            } else if (res.status === 503) {\n                throw new Error(res.data.reason);\n            } else {\n                throw new Error(`${res.status} - ${res.statusText}`);\n            }\n        } catch (error) {\n            if (axios.isCancel(error)) {\n                throw new Error(\"Request timed out\");\n            } else if (error.response) {\n                // Re-throw with the original error message if it's already formatted\n                throw error;\n            } else {\n                throw new Error(error.message);\n            }\n        }\n    }\n}\n\nmodule.exports = {\n    RabbitMqMonitorType,","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/louislam/uptime-kuma/blob/6b5ea0155793e666666745fb8d6fef1e829543a2/server/monitor-types/rabbitmq.js#L77-L113","documentation":"RabbitMQ's management API returns HTTP 503 when the node/cluster is considered unhealthy and includes a `reason` field in the JSON body (e.g. a resource alarm). checkSingleNode special-cases 503 to surface that reason directly rather than the generic status text. So the message is whatever the RabbitMQ HTTP API put in res.data.reason.","triggerScenarios":"axios.request returns status 503 with a JSON body containing `reason`. Common reasons include resource alarms (disk or memory), node not running, or maintenance mode. The branch at rabbitmq.js:95 throws res.data.reason verbatim.","commonSituations":"Disk alarm (disk_free < disk_free_limit), memory alarm (mem_above watermark), node paused, or the cluster in a degraded state where the management plugin still answers 503.","solutions":["Resolve the alarm reported in `reason`: free disk space, raise vm_memory_high_watermark, or clear the alarm with `rabbitmqctl clear_resource_alarm <name>`.","Inspect cluster state: `rabbitmqctl status`, `rabbitmqctl cluster_status`, and the management UI overview.","Confirm the node being queried is the one in alarm; rotate through each node URL.","Tune limits (disk_free_limit, vm_memory_high_watermark) so transient load does not trip 503."],"exampleFix":"# before\nreason: \"memory resource alarm\"\n# after\nrabbitmqctl set_vm_memory_high_watermark absolute=2GB && rabbitmqctl clear_resource_alarm memory","handlingStrategy":"try-catch","validationCode":"// Pre-flight: call the aliveness endpoint; if 503, surface the reason early.\nasync function preflightRabbitNode(monitor, baseUrl) {\n  const res = await axios.get(`${baseUrl}/api/aliveness-test/%2F`, { auth: { username: monitor.rabbitmqUsername, password: monitor.rabbitmqPassword } });\n  if (res.status === 503 && res.data?.reason) {\n    throw new Error(res.data.reason);\n  }\n}","typeGuard":"function hasResourceAlarmReason(data) { return !!data && typeof data.reason === 'string'; }","tryCatchPattern":"try {\n  await checkSingleNode(monitor, baseUrl, nodeInfo);\n} catch (e) {\n  if (/resource alarm|disk|memory/i.test(e.message)) {\n    alertOps('RabbitMQ resource alarm: ' + e.message);\n  }\n  throw e;\n}","preventionTips":["Monitor disk_free and vm_memory_high_watermark proactively so 503 never triggers.","Set up separate alerts for disk and memory alarms at the OS level.","Page on 503 distinctly from 5xx so responders know it is a cluster-health issue."],"tags":["rabbitmq","http","cluster-health","resource-alarm"],"backgroundTag":null,"analyzedSha":"6b5ea0155793e666666745fb8d6fef1e829543a2","analyzedAt":"2026-08-12T23:42:12.959Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}