{"record":{"id":"275f1a8ae9d82fb9","repo":"louislam/uptime-kuma","slug":"unknown-mqtt-check-type","errorCode":null,"errorMessage":"Unknown MQTT Check Type","messagePattern":"Unknown MQTT Check Type","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"server/monitor-types/mqtt.js","lineNumber":48,"sourceCode":"            websocketPath: monitor.mqttWebsocketPath,\n        });\n\n        if (monitor.mqttCheckType == null || monitor.mqttCheckType === \"\") {\n            monitor.mqttCheckType = \"keyword\";\n        }\n\n        // Check if conditions are defined\n        const conditions = monitor.conditions ? ConditionExpressionGroup.fromMonitor(monitor) : null;\n        const hasConditions = conditions && conditions.children && conditions.children.length > 0;\n\n        if (hasConditions) {\n            await this.checkConditions(monitor, heartbeat, messageTopic, receivedMessage, conditions);\n        } else if (monitor.mqttCheckType === \"keyword\") {\n            this.checkKeyword(monitor, heartbeat, messageTopic, receivedMessage);\n        } else if (monitor.mqttCheckType === \"json-query\") {\n            await this.checkJsonQuery(monitor, heartbeat, receivedMessage);\n        } else {\n            throw new Error(\"Unknown MQTT Check Type\");\n        }\n    }\n\n    /**\n     * Check using keyword matching\n     * @param {object} monitor Monitor object\n     * @param {object} heartbeat Heartbeat object\n     * @param {string} messageTopic Received MQTT topic\n     * @param {string} receivedMessage Received MQTT message\n     * @returns {void}\n     * @throws {Error} If keyword is not found in message\n     */\n    checkKeyword(monitor, heartbeat, messageTopic, receivedMessage) {\n        if (receivedMessage != null && receivedMessage.includes(monitor.mqttSuccessMessage)) {\n            heartbeat.msg = `Topic: ${messageTopic}; Message: ${receivedMessage}`;\n            heartbeat.status = UP;\n        } else {\n            throw new Error(`Message Mismatch - Topic: ${monitor.mqttTopic}; Message: ${receivedMessage}`);","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/louislam/uptime-kuma/blob/6b5ea0155793e666666745fb8d6fef1e829543a2/server/monitor-types/mqtt.js#L30-L66","documentation":"Thrown by the MQTT monitor when mqttCheckType is not 'keyword', not 'json-query', and no condition group is defined (or it has no children). The code falls through every branch to the else. Note: null/empty mqttCheckType is normalised to 'keyword' earlier, so this only fires for a genuinely unrecognised non-empty value.","triggerScenarios":"monitor.mqttCheckType is a non-empty string that is neither 'keyword' nor 'json-query', AND monitor.conditions is absent or produces a ConditionExpressionGroup with zero children.","commonSituations":"mqttCheckType was set to a value from a newer Uptime Kuma version this build doesn't recognise, the DB column was manually edited to an invalid value, or a migration wrote an unexpected enum.","solutions":["Set mqttCheckType to 'keyword' or 'json-query' (or clear it, which defaults to 'keyword')","If you intended condition-based checks, define at least one condition so hasConditions is true","Upgrade Uptime Kuma if a newer version supports the check type you need","Inspect the monitor record in the DB to confirm the mqttCheckType value is not corrupted"],"exampleFix":"// before: unknown value\nmonitor.mqttCheckType = \"regex\"; // unsupported -> throws\n// after: supported value\nmonitor.mqttCheckType = \"keyword\";","handlingStrategy":"type-guard","validationCode":"const validTypes = [\"keyword\", \"json-query\"];\nif (monitor.mqttCheckType == null || monitor.mqttCheckType === \"\") {\n    monitor.mqttCheckType = \"keyword\";\n} else if (!validTypes.includes(monitor.mqttCheckType) && !hasConditions) {\n    throw new Error(\"Unknown MQTT Check Type: \" + monitor.mqttCheckType);\n}","typeGuard":"/** @param {string} t */\nfunction isKnownMqttCheckType(t) {\n    return t === \"keyword\" || t === \"json-query\";\n}","tryCatchPattern":"// Validate the enum value early so the error is actionable\nif (!hasConditions && !isKnownMqttCheckType(monitor.mqttCheckType)) {\n    throw new Error(\"Unknown MQTT Check Type: \" + monitor.mqttCheckType);\n}","preventionTips":["Constrain mqttCheckType to the supported enum at the UI/API layer","If you rely on conditions, ensure at least one child condition exists","Upgrade Uptime Kuma to gain new check types rather than hand-editing the DB"],"tags":["mqtt","check-type","config","enum"],"backgroundTag":null,"analyzedSha":"6b5ea0155793e666666745fb8d6fef1e829543a2","analyzedAt":"2026-08-12T23:42:12.959Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}