{"record":{"id":"ec92643f515868bf","repo":"louislam/uptime-kuma","slug":"pagerduty-notification-failed-with-invalid-respons","errorCode":null,"errorMessage":"PagerDuty notification failed with invalid response!","messagePattern":"PagerDuty notification failed with invalid response!","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"server/notification-providers/pagerduty.js","lineNumber":46,"sourceCode":"\n            if (heartbeatJSON.status === DOWN) {\n                const title = \"Uptime Kuma Monitor 🔴 Down\";\n                return this.postNotification(notification, title, heartbeatJSON.msg, monitorJSON, \"trigger\");\n            }\n        } catch (error) {\n            this.throwGeneralAxiosError(error);\n        }\n    }\n\n    /**\n     * Check if result is successful, result code should be in range 2xx\n     * @param {object} result Axios response object\n     * @returns {void}\n     * @throws {Error} The status code is not in range 2xx\n     */\n    checkResult(result) {\n        if (result.status == null) {\n            throw new Error(\"PagerDuty notification failed with invalid response!\");\n        }\n        if (result.status < 200 || result.status >= 300) {\n            throw new Error(\"PagerDuty notification failed with status code \" + result.status);\n        }\n    }\n\n    /**\n     * Send the message\n     * @param {BeanModel} notification Message title\n     * @param {string} title Message title\n     * @param {string} body Message\n     * @param {object} monitorInfo Monitor details (For Up/Down only)\n     * @param {?string} eventAction Action event for PagerDuty (trigger, acknowledge, resolve)\n     * @returns {Promise<string>} Success message\n     */\n    async postNotification(notification, title, body, monitorInfo, eventAction = \"trigger\") {\n        let monitorUrl;\n        if (monitorInfo.type === \"port\") {","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/louislam/uptime-kuma/blob/6b5ea0155793e666666745fb8d6fef1e829543a2/server/notification-providers/pagerduty.js#L28-L64","documentation":"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.","triggerScenarios":"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.","commonSituations":"A misbehaving HTTP proxy stripping the status line; test mocks that forget to set status; an axios interceptor transforming the response incorrectly.","solutions":["Inspect the actual response object PagerDuty received (log result) to see why status is null.","Remove or fix any custom axios interceptors/adapters on the request path.","If a proxy is in front of PagerDuty, ensure it forwards the HTTP status line.","In tests, always set status on mocked responses."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":"/** @param {unknown} r */\nfunction hasHttpStatus(r) {\n    return typeof r === \"object\" && r !== null &&\n        typeof r.status === \"number\" && r.status >= 100 && r.status < 600;\n}","tryCatchPattern":"if (!hasHttpStatus(result)) {\n    throw new Error(\"PagerDuty returned a malformed response (no HTTP status)\");\n}","preventionTips":["In tests/mocks, always set response.status.","Avoid axios interceptors that drop the status field.","Ensure proxies forward the HTTP status line unchanged."],"tags":["pagerduty","http","validation","response-shape","defensive"],"backgroundTag":null,"analyzedSha":"6b5ea0155793e666666745fb8d6fef1e829543a2","analyzedAt":"2026-08-12T23:42:12.959Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}