{"record":{"id":"7a6d9611cfc19235","repo":"louislam/uptime-kuma","slug":"received-unexpected-status-code-result-status-f","errorCode":null,"errorMessage":"Received unexpected status code ${result.status} from notification provider HaloPSA","messagePattern":"Received unexpected status code (.+?) from notification provider HaloPSA","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"server/notification-providers/HaloPSA.js","lineNumber":73,"sourceCode":"            };\n\n            if (notification.haloUsername && notification.haloPassword) {\n                const data = notification.haloUsername + \":\" + notification.haloPassword;\n                const base64data = Buffer.from(data).toString(\"base64\");\n\n                config.headers.Authorization = `Basic ${base64data}`;\n            }\n\n            config = this.getAxiosConfigWithProxy(config);\n\n            const result = await axios.post(notification.halowebhookurl, payload, config);\n\n            // Check for successful HTTP response\n            if (result.status === 200 || result.status === 201 || result.status === 204) {\n                return okMsg;\n            }\n\n            throw new Error(`Received unexpected status code ${result.status} from notification provider HaloPSA`);\n        } catch (error) {\n            this.throwGeneralAxiosError(error);\n        }\n    }\n}\n\nmodule.exports = HaloPSA;\n","sourceCodeStart":55,"sourceCodeEnd":81,"githubUrl":"https://github.com/louislam/uptime-kuma/blob/6b5ea0155793e666666745fb8d6fef1e829543a2/server/notification-providers/HaloPSA.js#L55-L81","documentation":"HaloPSA.js:67-73. After POSTing the alert payload to notification.halowebhookurl, the provider only accepts 200/201/204. Any other HTTP status — even a 2xx like 202, or a 3xx/4xx/5xx — trips this generic message.","triggerScenarios":"HaloPSA webhook URL wrong/expired (404), auth header missing/wrong (401/403), webhook rate-limited (429), HaloPSA backend error (500), or a 202 Accepted that the strict allow-list does not include.","commonSituations":"Webhook URL copied from the wrong HaloPSA instance; integration API key rotated but not updated in Uptime Kuma; HaloPSA returns 202 for queued webhooks which this provider treats as failure.","solutions":["Capture result.status from logs and act on the specific code: 401/403 → fix credentials; 404 → fix URL; 429 → reduce alert volume; 5xx → HaloPSA-side incident.","Verify notification.halowebhookurl points to the active HaloPSA webhook endpoint.","If HaloPSA legitimately returns 202, extend the allow-list to include it.","Re-issue the HaloPSA API token and update it in the notification config."],"exampleFix":"// before: if (result.status === 200 || result.status === 201 || result.status === 204)\n// after: include 202 Accepted for queued webhooks\nif ([200, 201, 202, 204].includes(result.status)) { return okMsg; }","handlingStrategy":"validation","validationCode":"// Confirm URL shape + non-empty webhook before sending\nfunction validateHaloWebhook(notification) {\n    const u = notification.halowebhookurl;\n    if (!u || !/^https?:\\/\\/.+/.test(u)) throw new Error('HaloPSA webhook URL missing/invalid');\n    return u;\n}","typeGuard":"function isHaloResponseOk(s) { return s === 200 || s === 201 || s === 204; }","tryCatchPattern":"try { await provider.send(notification, msg, monitorJSON, heartbeatJSON); }\ncatch (e) {\n    if (/unexpected status code (\\d+)/.test(e.message)) {\n        const code = +e.message.match(/(\\d+)/)[1];\n        if (code === 401 || code === 403) log.error('HaloPSA auth failed — rotate token');\n        if (code >= 500) heartbeat.status = PENDING; // transient — retry next cycle\n    }\n}","preventionTips":["Treat HaloPSA token rotation as part of any key-management runbook.","If HaloPSA returns 202, widen the allow-list rather than ignoring failures."],"tags":["notification","http","halopsa","status-code","webhook"],"backgroundTag":null,"analyzedSha":"6b5ea0155793e666666745fb8d6fef1e829543a2","analyzedAt":"2026-08-12T23:42:12.959Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}