{"record":{"id":"f79679777d484519","repo":"louislam/uptime-kuma","slug":"bark-notification-failed-with-invalid-response","errorCode":null,"errorMessage":"Bark notification failed with invalid response!","messagePattern":"Bark notification failed with invalid response!","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"server/notification-providers/bark.js","lineNumber":82,"sourceCode":"        // picked a sound, this should follow system's mute status when arrival\n        if (notification.barkSound != null) {\n            params += \"&sound=\" + notification.barkSound;\n        } 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) {","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/louislam/uptime-kuma/blob/6b5ea0155793e666666745fb8d6fef1e829543a2/server/notification-providers/bark.js#L64-L100","documentation":"bark.js:78-86 (checkResult). A defensive guard: if the Axios response object has no `status` at all (null/undefined) the response is unusable, so the provider refuses to guess and throws 'invalid response'. Distinct from the status-out-of-range error.","triggerScenarios":"Axios returned a response with status unset (rare — usually means a network layer swallowed the HTTP layer), the Bark server returned a non-HTTP/empty byte stream, or a proxy returned an opaque object lacking status.","commonSituations":"Custom Bark-compatible self-hosted server returning malformed responses; intermediary that strips the status field; Axios interceptor mutating the response object.","solutions":["Confirm the Bark endpoint URL is correct and the server is up.","Test the endpoint directly: `curl -i https://api.day.app/<key>/<title>/<body>`.","If self-hosting Bark, upgrade to a version that returns proper HTTP status codes.","Remove any Axios response interceptors that overwrite the status field."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"// Verify the response shape before calling checkResult\nfunction isUsableResponse(r) { return r != null && typeof r.status === 'number'; }","typeGuard":"function hasBarkStatus(r) { return r != null && (typeof r.status === 'number' || r.status == null); }","tryCatchPattern":"try { provider.checkResult(result); }\ncatch (e) {\n    if (/invalid response/.test(e.message)) log.error('Bark returned a response with no HTTP status — endpoint malformed');\n}","preventionTips":["Self-hosted Bark servers should return proper HTTP status lines — keep them updated.","Avoid Axios interceptors that mutate the response shape."],"tags":["notification","bark","http","response"],"backgroundTag":null,"analyzedSha":"6b5ea0155793e666666745fb8d6fef1e829543a2","analyzedAt":"2026-08-12T23:42:12.959Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}