louislam/uptime-kuma · error · Error

${res.status} - ${res.statusText}

Error message

${res.status} - ${res.statusText}

What it means

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.

Source

Thrown at server/monitor-types/rabbitmq.js:97

            validateStatus: (status) => status === 200 || status === 503,
        };

        log.debug("monitor", `[${monitor.name}] Checking node ${nodeInfo}: ${baseUrl}`);

        try {
            const res = await axios.request(options);
            log.debug(
                "monitor",
                `[${monitor.name}] Axios Response: status=${res.status} body=${JSON.stringify(res.data)}`
            );

            if (res.status === 200) {
                log.debug("monitor", `[${monitor.name}] Node ${nodeInfo} is healthy`);
                // Success - return without error
            } else if (res.status === 503) {
                throw new Error(res.data.reason);
            } else {
                throw new Error(`${res.status} - ${res.statusText}`);
            }
        } catch (error) {
            if (axios.isCancel(error)) {
                throw new Error("Request timed out");
            } else if (error.response) {
                // Re-throw with the original error message if it's already formatted
                throw error;
            } else {
                throw new Error(error.message);
            }
        }
    }
}

module.exports = {
    RabbitMqMonitorType,
};

View on GitHub (pinned to 6b5ea01557)

Solutions

  1. If 401/403: verify rabbitmqUsername/rabbitmqPassword and the user's tags (e.g. management).
  2. If 404: enable rabbitmq_management and confirm the URL path/port (default 15672).
  3. If 5xx: inspect the RabbitMQ node logs for the underlying crash.
  4. Test directly: curl -i -u user:pass http://node:15672/api/overview and match the status.

Example fix

# before
401 - Unauthorized
# after
rabbitmqctl set_user_tags newuser management
Defensive patterns

Strategy: validation

Validate before calling

async function verifyRabbitCredsAndPlugin(baseUrl, user, pass) {
  const res = await axios.get(`${baseUrl}/api/whoami`, { auth: { username: user, password: pass }, validateStatus: () => true });
  if (res.status === 401 || res.status === 403) throw new Error('Bad RabbitMQ credentials');
  if (res.status === 404) throw new Error('Management plugin not enabled or wrong path');
}

Type guard

function isAuthStatus(status) { return status === 401 || status === 403; }

Try / catch

try {
  await checkSingleNode(monitor, baseUrl, nodeInfo);
} catch (e) {
  const m = e.message.match(/^(\d{3}) - /);
  if (m && (m[1] === '401' || m[1] === '403')) log.error('Fix RabbitMQ user/tags');
  if (m && m[1] === '404') log.error('Enable rabbitmq_management');
  throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of louislam/uptime-kuma@6b5ea01557 (2026-08-12). Data as JSON: /api/errors/275cc5aa34ab80d8. Report an issue: GitHub.