{"record":{"id":"c41e66e33b7d19d4","repo":"louislam/uptime-kuma","slug":"splunk-notification-failed-with-invalid-response","errorCode":null,"errorMessage":"Splunk notification failed with invalid response!","messagePattern":"Splunk notification failed with invalid response!","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"server/notification-providers/splunk.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(\"Splunk notification failed with invalid response!\");\n        }\n        if (result.status < 200 || result.status >= 300) {\n            throw new Error(\"Splunk 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 state\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/splunk.js#L28-L64","documentation":"Thrown by Splunk.checkResult when the axios response object has no status field at all (result.status == null, covering both null and undefined). A well-formed axios response always has a numeric status, so reaching this branch means the response object was synthesized, stripped, or came from a non-standard adapter/interceptor.","triggerScenarios":"An axios response interceptor returns a non-response object, a custom adapter (mock/proxy) returns {data} only, the request was short-circuited by a transformRequest bug, or a library upgrade changed the response shape. Also reachable in tests that pass a partial mock.","commonSituations":"Custom axios instance with interceptors that return only data, MITM/proxy tools rewriting the response, or unit tests feeding checkResult a hand-built object without status.","solutions":["Inspect the axios instance used by the Splunk provider for response interceptors that discard the status field.","If testing, ensure the mock response includes status (e.g. {status:200, statusText:'OK', data:{}}).","Check for an axios major-version mismatch that may have altered the response envelope.","Log the raw result object before checkResult to identify what shape is actually arriving."],"exampleFix":"// before\ncheckResult(result) {\n    if (result.status == null) {\n        throw new Error(\"Splunk notification failed with invalid response!\");\n    }\n}\n// after (diagnose the unexpected shape)\ncheckResult(result) {\n    if (result == null || result.status == null) {\n        throw new Error(`Splunk notification failed with invalid response: ${JSON.stringify(result)}`);\n    }\n}","handlingStrategy":"type-guard","validationCode":"// Guard against a non-axios response shape before checkResult is called\nfunction isAxiosResponse(r) {\n    return r && typeof r === \"object\" && typeof r.status === \"number\";\n}\nif (!isAxiosResponse(result)) {\n    throw new Error(`Splunk returned a non-standard response: ${JSON.stringify(result)}`);\n}","typeGuard":"/** Narrows to a valid axios response with a numeric status. */\nfunction isAxiosResponse(r) {\n    return r != null && typeof r === \"object\" && typeof r.status === \"number\";\n}","tryCatchPattern":"try {\n    const result = await axios.request(options);\n    if (result?.status == null) {\n        throw new Error(`Splunk notification failed with invalid response: ${JSON.stringify(result)}`);\n    }\n    if (result.status < 200 || result.status >= 300) {\n        throw new Error(`Splunk notification failed with status code ${result.status}`);\n    }\n} catch (err) {\n    this.throwGeneralAxiosError(err);\n}","preventionTips":["Review axios response interceptors that might strip the status field.","In tests, build mock responses with status + statusText + data.","Pin axios to a tested major version."],"tags":["splunk","notification-provider","axios","response-shape","defensive"],"backgroundTag":null,"analyzedSha":"6b5ea0155793e666666745fb8d6fef1e829543a2","analyzedAt":"2026-08-12T23:42:12.959Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}