{"record":{"id":"361decf78354c0f0","repo":"louislam/uptime-kuma","slug":"unsupported-recipient-type-notification-threema","errorCode":null,"errorMessage":"Unsupported recipient type: ${notification.threemaRecipientType}","messagePattern":"Unsupported recipient type: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"server/notification-providers/threema.js","lineNumber":38,"sourceCode":"\n        const data = {\n            from: notification.threemaSenderIdentity,\n            secret: notification.threemaSecret,\n            text: msg,\n        };\n\n        switch (notification.threemaRecipientType) {\n            case \"identity\":\n                data.to = notification.threemaRecipient;\n                break;\n            case \"phone\":\n                data.phone = notification.threemaRecipient;\n                break;\n            case \"email\":\n                data.email = notification.threemaRecipient;\n                break;\n            default:\n                throw new Error(`Unsupported recipient type: ${notification.threemaRecipientType}`);\n        }\n\n        try {\n            await axios.post(url, new URLSearchParams(data), config);\n            return \"Threema notification sent successfully.\";\n        } catch (error) {\n            const errorMessage = this.handleApiError(error);\n            this.throwGeneralAxiosError(errorMessage);\n        }\n    }\n\n    /**\n     * Handle Threema API errors\n     * @param {any} error The error to handle\n     * @returns {string} Additional error context\n     */\n    handleApiError(error) {\n        if (!error.response) {","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/louislam/uptime-kuma/blob/6b5ea0155793e666666745fb8d6fef1e829543a2/server/notification-providers/threema.js#L20-L56","documentation":"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.","triggerScenarios":"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.","commonSituations":"Old DB row predating the recipientType field, frontend version skew, or import from another instance with a different schema.","solutions":["Open the notification settings UI and re-select Identity / Phone / Email, then save.","If editing the DB directly, set threemaRecipientType to one of: 'identity', 'phone', 'email'.","Check for incomplete schema migrations after an Uptime Kuma upgrade (run the migrate script).","As a defensive code change, normalize undefined to 'identity' before the switch if that is the intended default."],"exampleFix":"// before\nswitch (notification.threemaRecipientType) {\n    case \"identity\": /*...*/ break;\n    /* ... */\n    default:\n        throw new Error(`Unsupported recipient type: ${notification.threemaRecipientType}`);\n}\n// after (coerce legacy/empty values instead of throwing on existing configs)\nconst recipientType = notification.threemaRecipientType || \"identity\";\nswitch (recipientType) { /* ... */ }","handlingStrategy":"validation","validationCode":"const ALLOWED = new Set([\"identity\", \"phone\", \"email\"]);\nif (!ALLOWED.has(notification.threemaRecipientType)) {\n    throw new Error(`threemaRecipientType must be one of ${[...ALLOWED].join(\", \")}`);\n}","typeGuard":"/** Narrows to a known Threema recipient type. */\nfunction isThreemaRecipientType(v) {\n    return v === \"identity\" || v === \"phone\" || v === \"email\";\n}","tryCatchPattern":"if (!isThreemaRecipientType(notification.threemaRecipientType)) {\n    throw new Error(`Unsupported recipient type: ${notification.threemaRecipientType}`);\n}\ntry { await axios.post(url, new URLSearchParams(data), config); } catch (e) { this.throwGeneralAxiosError(this.handleApiError(e)); }","preventionTips":["Always select a recipient type via the dropdown rather than hand-editing config.","Run schema migrations after upgrades so enum fields stay valid.","Add a DB-level CHECK constraint if your backend allows it."],"tags":["threema","notification-provider","config","enum","validation"],"backgroundTag":null,"analyzedSha":"6b5ea0155793e666666745fb8d6fef1e829543a2","analyzedAt":"2026-08-12T23:42:12.959Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}