louislam/uptime-kuma · error · Error

Unsupported recipient type: ${notification.threemaRecipientT

Error message

Unsupported recipient type: ${notification.threemaRecipientType}

What it means

Thrown by the Threema provider's switch statement when notification.threemaRecipientType does not match 'identity', 'phone', or 'email'. Threema's send_simple API requires exactly one addressing mode, so an unrecognized type means the notification bean was saved with an invalid value.

Source

Thrown at server/notification-providers/threema.js:38

        const data = {
            from: notification.threemaSenderIdentity,
            secret: notification.threemaSecret,
            text: msg,
        };

        switch (notification.threemaRecipientType) {
            case "identity":
                data.to = notification.threemaRecipient;
                break;
            case "phone":
                data.phone = notification.threemaRecipient;
                break;
            case "email":
                data.email = notification.threemaRecipient;
                break;
            default:
                throw new Error(`Unsupported recipient type: ${notification.threemaRecipientType}`);
        }

        try {
            await axios.post(url, new URLSearchParams(data), config);
            return "Threema notification sent successfully.";
        } catch (error) {
            const errorMessage = this.handleApiError(error);
            this.throwGeneralAxiosError(errorMessage);
        }
    }

    /**
     * Handle Threema API errors
     * @param {any} error The error to handle
     * @returns {string} Additional error context
     */
    handleApiError(error) {
        if (!error.response) {

View on GitHub (pinned to 6b5ea01557)

Solutions

  1. Open the notification settings UI and re-select Identity / Phone / Email, then save.
  2. If editing the DB directly, set threemaRecipientType to one of: 'identity', 'phone', 'email'.
  3. Check for incomplete schema migrations after an Uptime Kuma upgrade (run the migrate script).
  4. As a defensive code change, normalize undefined to 'identity' before the switch if that is the intended default.

Example fix

// before
switch (notification.threemaRecipientType) {
    case "identity": /*...*/ break;
    /* ... */
    default:
        throw new Error(`Unsupported recipient type: ${notification.threemaRecipientType}`);
}
// after (coerce legacy/empty values instead of throwing on existing configs)
const recipientType = notification.threemaRecipientType || "identity";
switch (recipientType) { /* ... */ }
Defensive patterns

Strategy: validation

Validate before calling

const ALLOWED = new Set(["identity", "phone", "email"]);
if (!ALLOWED.has(notification.threemaRecipientType)) {
    throw new Error(`threemaRecipientType must be one of ${[...ALLOWED].join(", ")}`);
}

Type guard

/** Narrows to a known Threema recipient type. */
function isThreemaRecipientType(v) {
    return v === "identity" || v === "phone" || v === "email";
}

Try / catch

if (!isThreemaRecipientType(notification.threemaRecipientType)) {
    throw new Error(`Unsupported recipient type: ${notification.threemaRecipientType}`);
}
try { await axios.post(url, new URLSearchParams(data), config); } catch (e) { this.throwGeneralAxiosError(this.handleApiError(e)); }

Prevention

When it happens

Trigger: Corrupted notification config (recipientType undefined/null/empty), a DB migration that renamed enum values, manual edits to the config JSON, or a frontend dropdown change that didn't persist one of the three known values.

Common situations: Old DB row predating the recipientType field, frontend version skew, or import from another instance with a different schema.

Related errors


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