louislam/uptime-kuma · warning · Error

No valid recipient phone number was provided.

Error message

No valid recipient phone number was provided.

What it means

Ooredoo splits notification.ooredooToNumber on whitespace/comma/semicolon, maps each through normalizePhoneNumber, filters empties, and throws 'No valid recipient phone number was provided.' if nothing remains. This is a preflight validation: no HTTP request is made when it fires. It means every entered token either was empty or normalized to an empty string.

Source

Thrown at server/notification-providers/ooredoo.js:26

class Ooredoo extends NotificationProvider {
    name = "Ooredoo";

    /**
     * @inheritdoc
     */
    async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
        const okMsg = "Sent Successfully.";
        const url = notification.ooredooServerUrl || "https://o-papi1-lb01.ooredoo.mv/bulk_sms/v2";

        // Users may enter recipients separated by comma, semicolon, space or
        // newline.
        const recipients = notification.ooredooToNumber
            .split(/[\s,;]+/)
            .map((number) => this.normalizePhoneNumber(number))
            .filter((number) => number !== "");

        if (recipients.length === 0) {
            throw new Error("No valid recipient phone number was provided.");
        }

        try {
            let config = {
                headers: {
                    "Content-Type": "application/x-www-form-urlencoded",
                    Authorization: "Bearer " + notification.ooredooBearerToken,
                },
            };
            config = this.getAxiosConfigWithProxy(config);

            // The gateway only accepts MAX_RECIPIENTS_PER_REQUEST numbers per
            // call, so send the recipients in batches of that size.
            for (let i = 0; i < recipients.length; i += MAX_RECIPIENTS_PER_REQUEST) {
                const batch = recipients.slice(i, i + MAX_RECIPIENTS_PER_REQUEST);
                const data = new URLSearchParams({
                    username: notification.ooredooUsername,
                    // The gateway expects the access key to be Base64 encoded.

View on GitHub (pinned to 6b5ea01557)

Solutions

  1. Enter at least one recipient in the Maldivian format the gateway expects (960XXXXXXX), or a form normalizePhoneNumber accepts.
  2. Remove stray commas/semicolons/blank entries from ooredooToNumber.
  3. Confirm normalizePhoneNumber logic matches the input format you are providing (country code, leading +, etc.).
Defensive patterns

Strategy: validation

Validate before calling

const recipients = String(notification.ooredooToNumber || "")
    .split(/[\s,;]+/)
    .map((n) => this.normalizePhoneNumber(n))
    .filter((n) => n !== "");
if (recipients.length === 0) {
    throw new Error("No valid recipient phone number was provided.");
}

Type guard

/** @param {string} n */
function isMaldivianPhone(n) {
    return /^960\d{7}$/.test(n);
}

Prevention

When it happens

Trigger: ooredooToNumber is empty or contains only separators/whitespace; every entered number is non-numeric/letters so normalizePhoneNumber returns ''; numbers lack the expected country code and the normalizer drops them.

Common situations: Recipient field left blank; recipients pasted with only punctuation; numbers in a format normalizePhoneNumber does not recognize (it targets Maldivian 960XXXXXXX format).

Related errors


AI-assisted analysis of louislam/uptime-kuma@6b5ea01557 (2026-08-12). Data as JSON: /api/errors/05cc058bade613e7. Report an issue: GitHub.