louislam/uptime-kuma · warning · Error

PagerDuty notification failed with invalid response!

Error message

PagerDuty notification failed with invalid response!

What it means

PagerDuty's checkResult(result) guard fires when result.status == null — i.e. the axios response object is present but lacks a numeric status (unexpected/empty response). This is a defensive check preceding the 2xx range check; it flags a malformed response rather than a clear HTTP failure.

Solutions

  1. Inspect the actual response object PagerDuty received (log result) to see why status is null.
  2. Remove or fix any custom axios interceptors/adapters on the request path.
  3. If a proxy is in front of PagerDuty, ensure it forwards the HTTP status line.
  4. In tests, always set status on mocked responses.
Defensive patterns

Strategy: type-guard

Type guard

/** @param {unknown} r */
function hasHttpStatus(r) {
    return typeof r === "object" && r !== null &&
        typeof r.status === "number" && r.status >= 100 && r.status < 600;
}

Try / catch

if (!hasHttpStatus(result)) {
    throw new Error("PagerDuty returned a malformed response (no HTTP status)");
}

Prevention

When it happens

Trigger: An interceptor or mock returned a response without a status field; axios was configured with a custom adapter/validateStatus that produced an abnormal response object; the Events API v2 response was rewritten by a proxy so status is missing.

Common situations: A misbehaving HTTP proxy stripping the status line; test mocks that forget to set status; an axios interceptor transforming the response incorrectly.

Related errors


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

Appendix: source

Thrown at server/notification-providers/pagerduty.js:46

            if (heartbeatJSON.status === DOWN) {
                const title = "Uptime Kuma Monitor 🔴 Down";
                return this.postNotification(notification, title, heartbeatJSON.msg, monitorJSON, "trigger");
            }
        } catch (error) {
            this.throwGeneralAxiosError(error);
        }
    }

    /**
     * Check if result is successful, result code should be in range 2xx
     * @param {object} result Axios response object
     * @returns {void}
     * @throws {Error} The status code is not in range 2xx
     */
    checkResult(result) {
        if (result.status == null) {
            throw new Error("PagerDuty notification failed with invalid response!");
        }
        if (result.status < 200 || result.status >= 300) {
            throw new Error("PagerDuty notification failed with status code " + result.status);
        }
    }

    /**
     * Send the message
     * @param {BeanModel} notification Message title
     * @param {string} title Message title
     * @param {string} body Message
     * @param {object} monitorInfo Monitor details (For Up/Down only)
     * @param {?string} eventAction Action event for PagerDuty (trigger, acknowledge, resolve)
     * @returns {Promise<string>} Success message
     */
    async postNotification(notification, title, body, monitorInfo, eventAction = "trigger") {
        let monitorUrl;
        if (monitorInfo.type === "port") {

View on GitHub (pinned to 6b5ea01557)