louislam/uptime-kuma · error · Error

${data?.error_string || JSON.stringify(data)}

Error message

${data?.error_string || JSON.stringify(data)}

What it means

bearsms.js:32-45. BearSMS returns HTTP 200 even on failure and signals errors in the JSON body. The provider throws when: data.status === 'ERR', data.error_string is truthy, OR none of the per-recipient results contain status:'OK'. The message is error_string when present, else the whole JSON dump.

Source

Thrown at server/notification-providers/bearsms.js:44

                params.append("from", notification.bearsmsSenderId);
            }

            // Non-GSM text (e.g. Hebrew) must be flagged as unicode
            if (/[^\x00-\x7F]/.test(cleanMsg)) {
                params.append("unicode", "1");
            }

            const url = `https://app.bearsms.com/index.php?${params.toString()}`;
            let config = this.getAxiosConfigWithProxy({});
            const response = await axios.get(url, config);

            // BearSMS responds with HTTP 200 even on failure.
            // Failure: {"status":"ERR","error":"100","error_string":"authentication failed"}
            // Success: {"data":[{"status":"OK","error":"0","smslog_id":"..."}],"error_string":null}
            const data = response.data;
            const results = Array.isArray(data?.data) ? data.data : [];
            if (data?.status === "ERR" || data?.error_string || !results.some((r) => r.status === "OK")) {
                throw new Error(data?.error_string || JSON.stringify(data));
            }

            return okMsg;
        } catch (error) {
            this.throwGeneralAxiosError(error);
        }
    }
}

module.exports = BearSMS;

View on GitHub (pinned to 6b5ea01557)

Solutions

  1. Read error_string — 'authentication failed' → fix user/pass; credit errors → top up; number errors → fix format.
  2. Log into the BearSMS dashboard to confirm account balance and API credentials.
  3. Reformat destination numbers to the required international format.
  4. If error_string is null but results are non-OK, inspect the dumped JSON for per-recipient error codes.
Defensive patterns

Strategy: type-guard

Validate before calling

// Pre-validate credentials + destination format
function bearPreflight(notification, phone) {
    if (!notification.username || !notification.password) throw new Error('BearSMS credentials missing');
    if (!/^\+?[1-9]\d{6,14}$/.test(phone)) throw new Error('Invalid BearSMS destination');
}

Type guard

function isBearSmsErrorBody(d) { return d && typeof d === 'object' && d.status === 'ERR'; }

Try / catch

try { await provider.send(...); }
catch (e) {
    if (/authentication failed/i.test(e.message)) log.error('BearSMS auth — fix user/pass');
    else if (/credit|balance/i.test(e.message)) heartbeat.status = PENDING;
}

Prevention

When it happens

Trigger: Wrong username/password ('authentication failed'), insufficient credits, an invalid destination number, or a partial failure where every recipient returned a non-OK status.

Common situations: BearSMS API credentials rotated; account out of SMS credits; destination numbers not in the international format BearSMS requires; recipient list all marked invalid by the gateway.

Related errors


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