louislam/uptime-kuma · error · Error
Unexpected status code: ${result.status}
Error message
Unexpected status code: ${result.status} What it means
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.
Source
Thrown at server/notification-providers/brevo.js:47
},
to: to,
subject: notification.brevoSubject || "Notification from Your Uptime Kuma",
htmlContent: `<html><head></head><body><p>${msg.replace(/\n/g, "<br>")}</p></body></html>`,
};
if (notification.brevoCcEmail) {
data.cc = notification.brevoCcEmail.split(",").map((email) => ({ email: email.trim() }));
}
if (notification.brevoBccEmail) {
data.bcc = notification.brevoBccEmail.split(",").map((email) => ({ email: email.trim() }));
}
let result = await axios.post("https://api.brevo.com/v3/smtp/email", data, config);
if (result.status === 201) {
return okMsg;
} else {
throw new Error(`Unexpected status code: ${result.status}`);
}
} catch (error) {
this.throwGeneralAxiosError(error);
}
}
}
module.exports = Brevo;
View on GitHub (pinned to 6b5ea01557)
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.
Example fix
// before: only 201 accepted
// after: accept documented success codes (Brevo may return 200/201)
if (result.status === 200 || result.status === 201) { return okMsg; } Defensive patterns
Strategy: validation
Validate before calling
// Validate sender + recipients before calling Brevo
function isEmail(s) { return /^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(s); }
function preflightBrevo(notification, to) {
if (!notification.brevoApiKey) throw new Error('Brevo API key missing');
if (!isEmail(notification.brevoSenderEmail)) throw new Error('Brevo sender email invalid');
to.split(',').forEach(e => { if (!isEmail(e.trim())) throw new Error(`Bad recipient: ${e}`); });
} Type guard
function isBrevoSuccess(s) { return s === 201 || s === 200; } Try / catch
try { await provider.send(...); }
catch (e) {
const code = (e.message.match(/(\d+)/) || [])[1];
if (code === '401' || code === '403') log.error('Brevo API key invalid/revoked');
if (code === '400') log.warn('Brevo rejected payload — check sender/recipient validity');
} Prevention
- Register and verify the sender domain in Brevo before configuring Uptime Kuma.
- Sanitize comma-separated cc/bcc lists for malformed addresses.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Received unexpected status code ${result.status} from notifi
- Bark notification failed with status code ${result.status}
- FlashDuty notification failed with status code ${result.stat
- Unexpected status code: ${result.status}
- Status code ${result.statusCode} not accepted. Output: ${res
AI-assisted analysis of louislam/uptime-kuma@6b5ea01557 (2026-08-12).
Data as JSON: /api/errors/f96bf6cd5117fdfd.
Report an issue: GitHub.