{"record":{"id":"2d9608ac6ed3d8e5","repo":"louislam/uptime-kuma","slug":"error-response-data-error-response-data-err","errorCode":null,"errorMessage":"${error.response.data ? error.response.data : \"Error without response\"}","messagePattern":"\\$\\{error\\.response\\.data \\? error\\.response\\.data : \"Error without response\"\\}","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"server/notification-providers/goalert.js","lineNumber":36,"sourceCode":"            if (heartbeatJSON != null && heartbeatJSON[\"status\"] === UP) {\n                data[\"action\"] = \"close\";\n            }\n            let headers = {\n                \"Content-Type\": \"multipart/form-data\",\n            };\n            let config = {\n                headers: headers,\n            };\n            config = this.getAxiosConfigWithProxy(config);\n            await axios.post(\n                `${notification.goAlertBaseURL}/api/v2/generic/incoming?token=${notification.goAlertToken}`,\n                data,\n                config\n            );\n            return okMsg;\n        } catch (error) {\n            let msg = error.response.data ? error.response.data : \"Error without response\";\n            throw new Error(msg);\n        }\n    }\n}\n\nmodule.exports = GoAlert;\n","sourceCodeStart":18,"sourceCodeEnd":42,"githubUrl":"https://github.com/louislam/uptime-kuma/blob/6b5ea0155793e666666745fb8d6fef1e829543a2/server/notification-providers/goalert.js#L18-L42","documentation":"Thrown by the GoAlert provider in its catch block. It posts to {goAlertBaseURL}/api/v2/generic/incoming?token={goAlertToken} and, on any thrown exception, checks error.response.data and re-throws it verbatim as the message (or the literal 'Error without response' when there is no response body). Because error.response.data is often an object or Buffer rather than a string, the resulting Error message may serialize oddly; and any non-response failure (DNS, timeout, bad token reaching a network layer) yields the generic fallback.","triggerScenarios":"GoAlert returns a non-2xx (axios rejects) with a body in error.response.data — e.g. 400 for a malformed token, 401/403 for an invalid goAlertToken, 404 for a wrong goAlertBaseURL. Also fires for connection-level failures (ECONNREFUSED, ENOTFOUND, ETIMEDOUT) where error.response is undefined, producing 'Error without response'.","commonSituations":"goAlertToken mistyped or revoked in GoAlert; goAlertBaseURL missing the scheme or pointing at an address without the /api/v2 route; GoAlert server behind a proxy that strips the query token; GoAlert not running / wrong port.","solutions":["Confirm goAlertBaseURL is a full URL (e.g. https://goalert.example.com) with no trailing /api/v2 and that GoAlert is reachable from the Uptime Kuma host.","Verify goAlertToken matches an active incoming token in GoAlert's Generic Integration settings.","Coerce the message to a string and surface status so the error is readable: String(error.response?.data ?? 'Error without response') plus HTTP status.","If you see 'Error without response', treat it as a network/DNS/timeout problem, not a GoAlert auth problem."],"exampleFix":"// before\nlet msg = error.response.data ? error.response.data : \"Error without response\";\nthrow new Error(msg);\n\n// after - readable, status-aware message\nif (error.response) {\n    const body = typeof error.response.data === \"string\" ? error.response.data : JSON.stringify(error.response.data);\n    throw new Error(`GoAlert API error (HTTP ${error.response.status}): ${body}`);\n}\nthrow new Error(`GoAlert request failed without response: ${error.code || error.message}`);","handlingStrategy":"try-catch","validationCode":"const base = String(notification.goAlertBaseURL || \"\").replace(/\\/+$/, \"\");\nif (!/^https?:\\/\\//.test(base)) {\n    throw new Error(\"goAlertBaseURL must be a full http(s) URL\");\n}\nif (!notification.goAlertToken) {\n    throw new Error(\"goAlertToken is required\");\n}","typeGuard":"/** @param {unknown} n */\nfunction isValidGoAlertConfig(n) {\n    return typeof n === \"object\" && n !== null &&\n        typeof n.goAlertBaseURL === \"string\" && /^https?:\\/\\//.test(n.goAlertBaseURL) &&\n        typeof n.goAlertToken === \"string\" && n.goAlertToken.length > 0;\n}","tryCatchPattern":"try {\n    await axios.post(url, data, config);\n} catch (error) {\n    if (error.response) {\n        const body = typeof error.response.data === \"string\"\n            ? error.response.data\n            : JSON.stringify(error.response.data);\n        throw new Error(`GoAlert HTTP ${error.response.status}: ${body}`);\n    }\n    throw new Error(`GoAlert transport error: ${error.code || error.message}`);\n}","preventionTips":["Differentiate response errors (auth/payload) from no-response errors (network/DNS).","Always stringify object bodies before embedding in an Error message.","Keep goAlertToken in a secret store and rotate without leaving stale values."],"tags":["network","http","goalert","error-handling","status-code"],"backgroundTag":null,"analyzedSha":"6b5ea0155793e666666745fb8d6fef1e829543a2","analyzedAt":"2026-08-12T23:42:12.959Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}