louislam/uptime-kuma · error · Error
Response max length cannot be less than 0
Error message
Response max length cannot be less than 0
What it means
validate() rejects a negative response_max_length. The field, when defined, must be 0 (meaning unlimited handling internally) or a positive byte count.
Source
Thrown at server/model/monitor.js:1636
}
/**
* Validate monitor configuration
* @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 {View on GitHub (pinned to 6b5ea01557)
Solutions
- Set response_max_length to 0 for unlimited, or a positive byte count
- Validate that numeric inputs are non-negative before submitting the form
Example fix
// before monitor.response_max_length = -1; // after monitor.response_max_length = 0;
Defensive patterns
Strategy: validation
Validate before calling
if (monitor.response_max_length !== undefined && monitor.response_max_length < 0) throw new Error("response_max_length must be >= 0"); Type guard
function isValidResponseMaxLength(v) { return v === undefined || (Number.isFinite(v) && v >= 0); } Try / catch
try { await socket.emit("addMonitor", payload); } catch (e) { /* surface e.message */ } Prevention
- Reject negative numerics at the form/API boundary
- Use 0 to express unlimited rather than sentinel negative values
When it happens
Trigger: Saving a monitor with response_max_length set to a negative number.
Common situations: Manual API/script passing a bad numeric value; form corruption; a -1 sentinel from another system.
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 more than ${RESPONSE_BODY_LENG
- 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/0271c30a222d4fd9.
Report an issue: GitHub.