{"record":{"id":"275cc5aa34ab80d8","repo":"louislam/uptime-kuma","slug":"res-status-res-statustext","errorCode":null,"errorMessage":"${res.status} - ${res.statusText}","messagePattern":"\\$\\{res\\.status\\} - \\$\\{res\\.statusText\\}","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"server/monitor-types/rabbitmq.js","lineNumber":97,"sourceCode":"            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,\n};\n","sourceCodeStart":79,"sourceCodeEnd":115,"githubUrl":"https://github.com/louislam/uptime-kuma/blob/6b5ea0155793e666666745fb8d6fef1e829543a2/server/monitor-types/rabbitmq.js#L79-L115","documentation":"When the RabbitMQ management endpoint returns a status that is neither 200 (healthy) nor 503 (cluster reason), checkSingleNode throws a generic `${res.status} - ${res.statusText}`. This catches authentication, authorization, not-found, and other HTTP errors uniformly because the upstream catch at line 104 will re-throw any error that already has `.response` unchanged.","triggerScenarios":"A node URL responds with 401/403 (bad credentials), 404 (management plugin disabled or wrong path), 5xx other than 503, or redirect loops. Any of these falls into the else branch at rabbitmq.js:97.","commonSituations":"Wrong rabbitmq username/password, management plugin not enabled (`rabbitmq-plugins enable rabbitmq_management`), wrong port (15672 vs 5672), or reverse proxy returning its own error.","solutions":["If 401/403: verify rabbitmqUsername/rabbitmqPassword and the user's tags (e.g. management).","If 404: enable rabbitmq_management and confirm the URL path/port (default 15672).","If 5xx: inspect the RabbitMQ node logs for the underlying crash.","Test directly: curl -i -u user:pass http://node:15672/api/overview and match the status."],"exampleFix":"# before\n401 - Unauthorized\n# after\nrabbitmqctl set_user_tags newuser management","handlingStrategy":"validation","validationCode":"async function verifyRabbitCredsAndPlugin(baseUrl, user, pass) {\n  const res = await axios.get(`${baseUrl}/api/whoami`, { auth: { username: user, password: pass }, validateStatus: () => true });\n  if (res.status === 401 || res.status === 403) throw new Error('Bad RabbitMQ credentials');\n  if (res.status === 404) throw new Error('Management plugin not enabled or wrong path');\n}","typeGuard":"function isAuthStatus(status) { return status === 401 || status === 403; }","tryCatchPattern":"try {\n  await checkSingleNode(monitor, baseUrl, nodeInfo);\n} catch (e) {\n  const m = e.message.match(/^(\\d{3}) - /);\n  if (m && (m[1] === '401' || m[1] === '403')) log.error('Fix RabbitMQ user/tags');\n  if (m && m[1] === '404') log.error('Enable rabbitmq_management');\n  throw e;\n}","preventionTips":["Grant the monitoring user the 'management' or 'monitoring' tag.","Enable rabbitmq_management on every cluster node.","Standardise on port 15672 for the management API."],"tags":["rabbitmq","http","authentication","config"],"backgroundTag":null,"analyzedSha":"6b5ea0155793e666666745fb8d6fef1e829543a2","analyzedAt":"2026-08-12T23:42:12.959Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}