{"record":{"id":"05cc058bade613e7","repo":"louislam/uptime-kuma","slug":"no-valid-recipient-phone-number-was-provided","errorCode":null,"errorMessage":"No valid recipient phone number was provided.","messagePattern":"No valid recipient phone number was provided\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"server/notification-providers/ooredoo.js","lineNumber":26,"sourceCode":"class Ooredoo extends NotificationProvider {\n    name = \"Ooredoo\";\n\n    /**\n     * @inheritdoc\n     */\n    async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {\n        const okMsg = \"Sent Successfully.\";\n        const url = notification.ooredooServerUrl || \"https://o-papi1-lb01.ooredoo.mv/bulk_sms/v2\";\n\n        // Users may enter recipients separated by comma, semicolon, space or\n        // newline.\n        const recipients = notification.ooredooToNumber\n            .split(/[\\s,;]+/)\n            .map((number) => this.normalizePhoneNumber(number))\n            .filter((number) => number !== \"\");\n\n        if (recipients.length === 0) {\n            throw new Error(\"No valid recipient phone number was provided.\");\n        }\n\n        try {\n            let config = {\n                headers: {\n                    \"Content-Type\": \"application/x-www-form-urlencoded\",\n                    Authorization: \"Bearer \" + notification.ooredooBearerToken,\n                },\n            };\n            config = this.getAxiosConfigWithProxy(config);\n\n            // The gateway only accepts MAX_RECIPIENTS_PER_REQUEST numbers per\n            // call, so send the recipients in batches of that size.\n            for (let i = 0; i < recipients.length; i += MAX_RECIPIENTS_PER_REQUEST) {\n                const batch = recipients.slice(i, i + MAX_RECIPIENTS_PER_REQUEST);\n                const data = new URLSearchParams({\n                    username: notification.ooredooUsername,\n                    // The gateway expects the access key to be Base64 encoded.","sourceCodeStart":8,"sourceCodeEnd":44,"githubUrl":"https://github.com/louislam/uptime-kuma/blob/6b5ea0155793e666666745fb8d6fef1e829543a2/server/notification-providers/ooredoo.js#L8-L44","documentation":"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.","triggerScenarios":"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.","commonSituations":"Recipient field left blank; recipients pasted with only punctuation; numbers in a format normalizePhoneNumber does not recognize (it targets Maldivian 960XXXXXXX format).","solutions":["Enter at least one recipient in the Maldivian format the gateway expects (960XXXXXXX), or a form normalizePhoneNumber accepts.","Remove stray commas/semicolons/blank entries from ooredooToNumber.","Confirm normalizePhoneNumber logic matches the input format you are providing (country code, leading +, etc.)."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const recipients = String(notification.ooredooToNumber || \"\")\n    .split(/[\\s,;]+/)\n    .map((n) => this.normalizePhoneNumber(n))\n    .filter((n) => n !== \"\");\nif (recipients.length === 0) {\n    throw new Error(\"No valid recipient phone number was provided.\");\n}","typeGuard":"/** @param {string} n */\nfunction isMaldivianPhone(n) {\n    return /^960\\d{7}$/.test(n);\n}","tryCatchPattern":null,"preventionTips":["Validate recipient format at save time, not just at send time.","Document the expected 960XXXXXXX format near the field.","Reject the field when it contains only separators/whitespace."],"tags":["config","validation","ooredoo","phone-number","recipient"],"backgroundTag":null,"analyzedSha":"6b5ea0155793e666666745fb8d6fef1e829543a2","analyzedAt":"2026-08-12T23:42:12.959Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}