{"record":{"id":"684ddfe6651d42a5","repo":"louislam/uptime-kuma","slug":"conditions-must-be-valid-json-e-message","errorCode":null,"errorMessage":"Conditions must be valid JSON: ${e.message}","messagePattern":"Conditions must be valid JSON: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"server/model/monitor.js","lineNumber":1673,"sourceCode":"                JSON.parse(this.kafkaProducerSaslOptions);\n            } catch (e) {\n                throw new Error(`Kafka Producer SASL Options must be valid JSON: ${e.message}`);\n            }\n        }\n\n        if (this.rabbitmqNodes) {\n            try {\n                JSON.parse(this.rabbitmqNodes);\n            } catch (e) {\n                throw new Error(`RabbitMQ Nodes must be valid JSON: ${e.message}`);\n            }\n        }\n\n        if (this.conditions) {\n            try {\n                JSON.parse(this.conditions);\n            } catch (e) {\n                throw new Error(`Conditions must be valid JSON: ${e.message}`);\n            }\n        }\n\n        if (this.headers) {\n            try {\n                JSON.parse(this.headers);\n            } catch (e) {\n                throw new Error(`Headers must be valid JSON: ${e.message}`);\n            }\n        }\n\n        if (this.accepted_statuscodes_json) {\n            try {\n                JSON.parse(this.accepted_statuscodes_json);\n            } catch (e) {\n                throw new Error(`Accepted status codes must be valid JSON: ${e.message}`);\n            }\n        }","sourceCodeStart":1655,"sourceCodeEnd":1691,"githubUrl":"https://github.com/louislam/uptime-kuma/blob/6b5ea0155793e666666745fb8d6fef1e829543a2/server/model/monitor.js#L1655-L1691","documentation":"validate() runs JSON.parse on the conditions field used by conditional monitoring logic. It must be valid JSON.","triggerScenarios":"conditions holds a non-JSON string when the monitor relies on conditional rules.","commonSituations":"Hand-editing the conditions outside the UI; partial/corrupted JSON from a migration.","solutions":["Provide conditions as valid JSON in the documented shape","Validate with JSON.parse before saving"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if (monitor.conditions) { JSON.parse(monitor.conditions); } // throws if invalid","typeGuard":"function isValidJsonField(v) { if (!v) return true; try { JSON.parse(v); return true; } catch { return false; } }","tryCatchPattern":"try { monitor.validate(); await save(monitor); } catch (e) { /* surface e.message */ }","preventionTips":["Edit conditions through the UI rather than hand-editing","Validate conditions JSON after any migration"],"tags":["json","validation","config","conditions"],"backgroundTag":null,"analyzedSha":"6b5ea0155793e666666745fb8d6fef1e829543a2","analyzedAt":"2026-08-12T23:42:12.959Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}