louislam/uptime-kuma · error · Error
PagerDuty notification failed with status code ${result.stat
Error message
PagerDuty notification failed with status code ${result.status} What it means
PagerDuty's checkResult(result) range guard: after confirming status is not null, it throws 'PagerDuty notification failed with status code <status>' for any status outside 200-299. This is the normal non-2xx failure path for the PagerDuty Events API v2 call (the surrounding code posts the PD event payload and passes the response here).
Source
Thrown at server/notification-providers/pagerduty.js:49
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") {
monitorUrl = monitorInfo.hostname;
if (monitorInfo.port) {
monitorUrl += ":" + monitorInfo.port;View on GitHub (pinned to 6b5ea01557)
Solutions
- Confirm the PagerDuty integration/routing key is correct and the integration is active.
- Validate the event payload against the Events API v2 schema (event_action, source, severity, dedup_key).
- On 429, reduce notification frequency / back off.
- On 4xx, log the response body to get PagerDuty's specific error details.
Defensive patterns
Strategy: try-catch
Validate before calling
if (!notification.pagerdutyIntegrationKey) {
throw new Error("pagerdutyIntegrationKey is required");
} Type guard
/** @param {{status:number}} r */
function is2xx(r) {
return typeof r.status === "number" && r.status >= 200 && r.status < 300;
} Try / catch
try {
const result = await axios.post(url, payload, config);
if (!is2xx(result)) {
throw new Error(`PagerDuty HTTP ${result.status}: ${JSON.stringify(result.data)}`);
}
} catch (e) {
if (e.response?.status === 429) { /* back off */ }
if (e.response?.status >= 500) { /* retry */ }
throw e;
} Prevention
- Validate the routing/integration key and payload schema before sending.
- Retry 5xx and 429; do not retry 4xx (config) errors.
- Log PagerDuty's response body for 4xx diagnosis.
When it happens
Trigger: PagerDuty returns 400 (malformed event payload / bad routing_key), 401/403 (bad auth), 429 (rate limited), 5xx (PagerDuty-side issue), or 422 (event action not permitted).
Common situations: Wrong or inactive routing_key/integration key for the PagerDuty service; event payload (dedup_key, event_action, severity) does not match the Events API v2 schema; PagerDuty incident limits hit.
Related errors
- Status code ${result.statusCode} not accepted. Output: ${res
- Received unexpected status code ${result.status} from notifi
- Bark notification failed with status code ${result.status}
- Unexpected status code: ${result.status}
- FlashDuty notification failed with status code ${result.stat
AI-assisted analysis of louislam/uptime-kuma@6b5ea01557 (2026-08-12).
Data as JSON: /api/errors/0003ef83800f4d7f.
Report an issue: GitHub.