{"record":{"id":"f96bf6cd5117fdfd","repo":"louislam/uptime-kuma","slug":"unexpected-status-code-result-status","errorCode":null,"errorMessage":"Unexpected status code: ${result.status}","messagePattern":"Unexpected status code: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"server/notification-providers/brevo.js","lineNumber":47,"sourceCode":"                },\n                to: to,\n                subject: notification.brevoSubject || \"Notification from Your Uptime Kuma\",\n                htmlContent: `<html><head></head><body><p>${msg.replace(/\\n/g, \"<br>\")}</p></body></html>`,\n            };\n\n            if (notification.brevoCcEmail) {\n                data.cc = notification.brevoCcEmail.split(\",\").map((email) => ({ email: email.trim() }));\n            }\n\n            if (notification.brevoBccEmail) {\n                data.bcc = notification.brevoBccEmail.split(\",\").map((email) => ({ email: email.trim() }));\n            }\n\n            let result = await axios.post(\"https://api.brevo.com/v3/smtp/email\", data, config);\n            if (result.status === 201) {\n                return okMsg;\n            } else {\n                throw new Error(`Unexpected status code: ${result.status}`);\n            }\n        } catch (error) {\n            this.throwGeneralAxiosError(error);\n        }\n    }\n}\n\nmodule.exports = Brevo;\n","sourceCodeStart":29,"sourceCodeEnd":56,"githubUrl":"https://github.com/louislam/uptime-kuma/blob/6b5ea0155793e666666745fb8d6fef1e829543a2/server/notification-providers/brevo.js#L29-L56","documentation":"brevo.js:42-49. The Brevo (Sendinblue) SMTP/email API is expected to return 201 Created on a successful send. Any other status — including a 200 — throws this generic message with the code.","triggerScenarios":"Invalid API key (401/403), malformed recipient or sender address (400), rate limit (429), Brevo platform error (5xx), or Brevo returning 200 in a future API revision the strict check does not accept.","commonSituations":"Brevo API key revoked/rotated; sender address not verified in Brevo dashboard; cc/bcc email list contains a malformed address causing a 400; daily quota exceeded.","solutions":["Capture result.status and map it: 401/403 → regenerate API key in Brevo; 400 → fix sender/recipient JSON; 429 → reduce volume; 5xx → Brevo incident.","Verify the sender address is registered and approved in the Brevo console.","Trim/validate the cc and bcc comma-separated lists for malformed entries.","Check Brevo plan quota and sender domain verification status."],"exampleFix":"// before: only 201 accepted\n// after: accept documented success codes (Brevo may return 200/201)\nif (result.status === 200 || result.status === 201) { return okMsg; }","handlingStrategy":"validation","validationCode":"// Validate sender + recipients before calling Brevo\nfunction isEmail(s) { return /^[^@\\s]+@[^@\\s]+\\.[^@\\s]+$/.test(s); }\nfunction preflightBrevo(notification, to) {\n    if (!notification.brevoApiKey) throw new Error('Brevo API key missing');\n    if (!isEmail(notification.brevoSenderEmail)) throw new Error('Brevo sender email invalid');\n    to.split(',').forEach(e => { if (!isEmail(e.trim())) throw new Error(`Bad recipient: ${e}`); });\n}","typeGuard":"function isBrevoSuccess(s) { return s === 201 || s === 200; }","tryCatchPattern":"try { await provider.send(...); }\ncatch (e) {\n    const code = (e.message.match(/(\\d+)/) || [])[1];\n    if (code === '401' || code === '403') log.error('Brevo API key invalid/revoked');\n    if (code === '400') log.warn('Brevo rejected payload — check sender/recipient validity');\n}","preventionTips":["Register and verify the sender domain in Brevo before configuring Uptime Kuma.","Sanitize comma-separated cc/bcc lists for malformed addresses."],"tags":["notification","email","brevo","http","status-code"],"backgroundTag":null,"analyzedSha":"6b5ea0155793e666666745fb8d6fef1e829543a2","analyzedAt":"2026-08-12T23:42:12.959Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}