louislam/uptime-kuma · error · Error
Response max length cannot be more than ${RESPONSE_BODY_LENG
Error message
Response max length cannot be more than ${RESPONSE_BODY_LENGTH_MAX} bytes What it means
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.
Source
Thrown at server/model/monitor.js:1640
* @returns {void}
* @throws {Error} If validation fails
*/
validate() {
if (this.interval < MIN_INTERVAL_SECOND) {
throw new Error(`Interval cannot be less than ${MIN_INTERVAL_SECOND} seconds`);
}
if (this.retryInterval < MIN_INTERVAL_SECOND) {
throw new Error(`Retry interval cannot be less than ${MIN_INTERVAL_SECOND} seconds`);
}
if (this.response_max_length !== undefined) {
if (this.response_max_length < 0) {
throw new Error(`Response max length cannot be less than 0`);
}
if (this.response_max_length > RESPONSE_BODY_LENGTH_MAX) {
throw new Error(`Response max length cannot be more than ${RESPONSE_BODY_LENGTH_MAX} bytes`);
}
}
// Validate JSON fields to prevent invalid JSON from being stored in database
if (this.kafkaProducerBrokers) {
try {
JSON.parse(this.kafkaProducerBrokers);
} catch (e) {
throw new Error(`Kafka Producer Brokers must be valid JSON: ${e.message}`);
}
}
if (this.kafkaProducerSaslOptions) {
try {
JSON.parse(this.kafkaProducerSaslOptions);
} catch (e) {
throw new Error(`Kafka Producer SASL Options must be valid JSON: ${e.message}`);
}View on GitHub (pinned to 6b5ea01557)
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
Example fix
// before monitor.response_max_length = 5000000; // after monitor.response_max_length = 1048576;
Defensive patterns
Strategy: validation
Validate before calling
const RESPONSE_BODY_LENGTH_MAX = 1024 * 1024;
if (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`); Type guard
const RESPONSE_BODY_LENGTH_MAX = 1024 * 1024;
function isValidResponseMaxLength(v) { return v === undefined || (Number.isFinite(v) && v >= 0 && v <= RESPONSE_BODY_LENGTH_MAX); } Try / catch
try { await socket.emit("addMonitor", payload); } catch (e) { /* surface e.message */ } Prevention
- Remember the unit is bytes, not KB/MB
- Cap at 1048576 or leave at 0 for the default
When it happens
Trigger: Saving a monitor with response_max_length greater than 1048576 bytes.
Common situations: User wants to capture large bodies; value entered in KB/MB units while the field expects raw bytes.
Related errors
- Interval cannot be less than ${MIN_INTERVAL_SECOND} seconds
- Retry interval cannot be less than ${MIN_INTERVAL_SECOND} se
- Response max length cannot be less than 0
- Kafka Producer Brokers must be valid JSON: ${e.message}
- Kafka Producer SASL Options must be valid JSON: ${e.message}
AI-assisted analysis of louislam/uptime-kuma@6b5ea01557 (2026-08-12).
Data as JSON: /api/errors/7e60c956dbb145bf.
Report an issue: GitHub.