{"record":{"id":"7e60c956dbb145bf","repo":"louislam/uptime-kuma","slug":"response-max-length-cannot-be-more-than-response","errorCode":null,"errorMessage":"Response max length cannot be more than ${RESPONSE_BODY_LENGTH_MAX} bytes","messagePattern":"Response max length cannot be more than (.+?) bytes","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"server/model/monitor.js","lineNumber":1640,"sourceCode":"     * @returns {void}\n     * @throws {Error} If validation fails\n     */\n    validate() {\n        if (this.interval < MIN_INTERVAL_SECOND) {\n            throw new Error(`Interval cannot be less than ${MIN_INTERVAL_SECOND} seconds`);\n        }\n\n        if (this.retryInterval < MIN_INTERVAL_SECOND) {\n            throw new Error(`Retry interval cannot be less than ${MIN_INTERVAL_SECOND} seconds`);\n        }\n\n        if (this.response_max_length !== undefined) {\n            if (this.response_max_length < 0) {\n                throw new Error(`Response max length cannot be less than 0`);\n            }\n\n            if (this.response_max_length > RESPONSE_BODY_LENGTH_MAX) {\n                throw new Error(`Response max length cannot be more than ${RESPONSE_BODY_LENGTH_MAX} bytes`);\n            }\n        }\n\n        // Validate JSON fields to prevent invalid JSON from being stored in database\n        if (this.kafkaProducerBrokers) {\n            try {\n                JSON.parse(this.kafkaProducerBrokers);\n            } catch (e) {\n                throw new Error(`Kafka Producer Brokers must be valid JSON: ${e.message}`);\n            }\n        }\n\n        if (this.kafkaProducerSaslOptions) {\n            try {\n                JSON.parse(this.kafkaProducerSaslOptions);\n            } catch (e) {\n                throw new Error(`Kafka Producer SASL Options must be valid JSON: ${e.message}`);\n            }","sourceCodeStart":1622,"sourceCodeEnd":1658,"githubUrl":"https://github.com/louislam/uptime-kuma/blob/6b5ea0155793e666666745fb8d6fef1e829543a2/server/model/monitor.js#L1622-L1658","documentation":"validate() rejects response_max_length above RESPONSE_BODY_LENGTH_MAX, which is 1024*1024 (1048576 bytes, 1 MiB). Caps how much response body Uptime Kuma will store/inspect.","triggerScenarios":"Saving a monitor with response_max_length greater than 1048576 bytes.","commonSituations":"User wants to capture large bodies; value entered in KB/MB units while the field expects raw bytes.","solutions":["Cap response_max_length at 1048576 bytes, or leave it at 0 for the default/unlimited handling","Note the unit is bytes, not KB/MB: 2 means 2 bytes, not 2 megabytes"],"exampleFix":"// before\nmonitor.response_max_length = 5000000;\n\n// after\nmonitor.response_max_length = 1048576;","handlingStrategy":"validation","validationCode":"const RESPONSE_BODY_LENGTH_MAX = 1024 * 1024;\nif (monitor.response_max_length !== undefined && monitor.response_max_length > RESPONSE_BODY_LENGTH_MAX) throw new Error(`response_max_length must be <= ${RESPONSE_BODY_LENGTH_MAX} bytes`);","typeGuard":"const RESPONSE_BODY_LENGTH_MAX = 1024 * 1024;\nfunction isValidResponseMaxLength(v) { return v === undefined || (Number.isFinite(v) && v >= 0 && v <= RESPONSE_BODY_LENGTH_MAX); }","tryCatchPattern":"try { await socket.emit(\"addMonitor\", payload); } catch (e) { /* surface e.message */ }","preventionTips":["Remember the unit is bytes, not KB/MB","Cap at 1048576 or leave at 0 for the default"],"tags":["validation","config"],"backgroundTag":null,"analyzedSha":"6b5ea0155793e666666745fb8d6fef1e829543a2","analyzedAt":"2026-08-12T23:42:12.959Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}