louislam/uptime-kuma · error · Error

Bark notification failed with status code ${result.status}

Error message

Bark notification failed with status code ${result.status}

What it means

bark.js:84-85 (checkResult). The response HAS a status but it falls outside the 200-299 success band. The thrown message includes the offending status for diagnosis.

Source

Thrown at server/notification-providers/bark.js:85

        } else {
            // default sound
            params += "&sound=" + "telegraph";
        }
        return params;
    }

    /**
     * Check if result is successful
     * @param {object} result Axios response object
     * @returns {void}
     * @throws {Error} The status code is not in range 2xx
     */
    checkResult(result) {
        if (result.status == null) {
            throw new Error("Bark notification failed with invalid response!");
        }
        if (result.status < 200 || result.status >= 300) {
            throw new Error("Bark notification failed with status code " + result.status);
        }
    }

    /**
     * Send the message
     * @param {BeanModel} notification Notification to send
     * @param {string} title Message title
     * @param {string} subtitle Message
     * @param {string} endpoint Endpoint to send request to
     * @returns {Promise<string>} Success message
     */
    async postNotification(notification, title, subtitle, endpoint) {
        let result;
        let config = this.getAxiosConfigWithProxy({});
        if (notification.apiVersion === "v1" || notification.apiVersion == null) {
            // url encode title and subtitle
            title = encodeURIComponent(title);
            subtitle = encodeURIComponent(subtitle);

View on GitHub (pinned to 6b5ea01557)

Solutions

  1. Use the status in the message: 400/401 → copy the current device key from the Bark app; 404 → verify the endpoint URL; 429 → lower alert frequency; 5xx → Bark-side incident.
  2. Open the Bark app and copy the fresh key into the notification provider config.
  3. Validate the endpoint URL against the Bark documentation (e.g. https://api.day.app/<key>).
  4. Retry after rate-limit window expires if 429.
Defensive patterns

Strategy: validation

Validate before calling

// Pre-validate the Bark device key format
function validBarkKey(url) { return /\/[^/]+\/?$/.test(url); }

Type guard

function isBarkOkStatus(s) { return typeof s === 'number' && s >= 200 && s < 300; }

Try / catch

try { provider.checkResult(result); }
catch (e) {
    const code = (e.message.match(/(\d+)/) || [])[1];
    if (code === '401' || code === '400') log.error('Bark device key invalid — copy fresh key from the app');
    if (code === '429') heartbeat.status = PENDING;
}

Prevention

When it happens

Trigger: Bark device key invalid/revoked (400/401), rate-limited (429), Bark server error (500), or the endpoint URL targets the wrong path returning 404.

Common situations: User reinstalled the Bark app generating a new key but did not update Uptime Kuma; Bark Cloudflare-fronted endpoint returning 5xx during an outage; wrong server hostname typo causing a 404.

Related errors


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