{"record":{"id":"de9f978f1acbf28b","repo":"louislam/uptime-kuma","slug":"bark-notification-failed-with-status-code-result","errorCode":null,"errorMessage":"Bark notification failed with status code ${result.status}","messagePattern":"Bark notification failed with status code (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"server/notification-providers/bark.js","lineNumber":85,"sourceCode":"        } else {\n            // default sound\n            params += \"&sound=\" + \"telegraph\";\n        }\n        return params;\n    }\n\n    /**\n     * Check if result is successful\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(\"Bark notification failed with invalid response!\");\n        }\n        if (result.status < 200 || result.status >= 300) {\n            throw new Error(\"Bark notification failed with status code \" + result.status);\n        }\n    }\n\n    /**\n     * Send the message\n     * @param {BeanModel} notification Notification to send\n     * @param {string} title Message title\n     * @param {string} subtitle Message\n     * @param {string} endpoint Endpoint to send request to\n     * @returns {Promise<string>} Success message\n     */\n    async postNotification(notification, title, subtitle, endpoint) {\n        let result;\n        let config = this.getAxiosConfigWithProxy({});\n        if (notification.apiVersion === \"v1\" || notification.apiVersion == null) {\n            // url encode title and subtitle\n            title = encodeURIComponent(title);\n            subtitle = encodeURIComponent(subtitle);","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/louislam/uptime-kuma/blob/6b5ea0155793e666666745fb8d6fef1e829543a2/server/notification-providers/bark.js#L67-L103","documentation":"bark.js:84-85 (checkResult). The response HAS a status but it falls outside the 200-299 success band. The thrown message includes the offending status for diagnosis.","triggerScenarios":"Bark device key invalid/revoked (400/401), rate-limited (429), Bark server error (500), or the endpoint URL targets the wrong path returning 404.","commonSituations":"User reinstalled the Bark app generating a new key but did not update Uptime Kuma; Bark Cloudflare-fronted endpoint returning 5xx during an outage; wrong server hostname typo causing a 404.","solutions":["Use the status in the message: 400/401 → copy the current device key from the Bark app; 404 → verify the endpoint URL; 429 → lower alert frequency; 5xx → Bark-side incident.","Open the Bark app and copy the fresh key into the notification provider config.","Validate the endpoint URL against the Bark documentation (e.g. https://api.day.app/<key>).","Retry after rate-limit window expires if 429."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Pre-validate the Bark device key format\nfunction validBarkKey(url) { return /\\/[^/]+\\/?$/.test(url); }","typeGuard":"function isBarkOkStatus(s) { return typeof s === 'number' && s >= 200 && s < 300; }","tryCatchPattern":"try { provider.checkResult(result); }\ncatch (e) {\n    const code = (e.message.match(/(\\d+)/) || [])[1];\n    if (code === '401' || code === '400') log.error('Bark device key invalid — copy fresh key from the app');\n    if (code === '429') heartbeat.status = PENDING;\n}","preventionTips":["Treat Bark app reinstalls as a trigger to refresh the device key in Uptime Kuma.","Confirm the endpoint hostname spelling before saving."],"tags":["notification","bark","http","status-code"],"backgroundTag":null,"analyzedSha":"6b5ea0155793e666666745fb8d6fef1e829543a2","analyzedAt":"2026-08-12T23:42:12.959Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}