xuxueli/xxl-job · error · ParseException
Increment >= 31 : {}
Error message
Increment >= 31 : {} What it means
Thrown by checkIncrementRange when a step/increment value in the Day-of-Month field exceeds 31. Since months have at most 31 days, an increment of 32 or more is rejected.
Source
Thrown at xxl-job-admin/src/main/java/com/xxl/job/admin/business/scheduler/cron/CronExpression.java:732
i = vs.pos;
}
i = checkNext(i, s, val, type);
return i;
}
} else {
throw new ParseException("Unexpected character: " + c, i);
}
return i;
}
private void checkIncrementRange(int incr, int type, int idxPos) throws ParseException {
if (incr > 59 && (type == SECOND || type == MINUTE)) {
throw new ParseException("Increment >= 60 : " + incr, idxPos);
} else if (incr > 23 && (type == HOUR)) {
throw new ParseException("Increment >= 24 : " + incr, idxPos);
} else if (incr > 31 && (type == DAY_OF_MONTH)) {
throw new ParseException("Increment >= 31 : " + incr, idxPos);
} else if (incr > 7 && (type == DAY_OF_WEEK)) {
throw new ParseException("Increment >= 7 : " + incr, idxPos);
} else if (incr > 12 && (type == MONTH)) {
throw new ParseException("Increment >= 12 : " + incr, idxPos);
}
}
protected int checkNext(int pos, String s, int val, int type)
throws ParseException {
int end = -1;
int i = pos;
if (i >= s.length()) {
addToSet(val, end, -1, type);
return i;
}
View on GitHub (pinned to e74c784f68)
Solutions
- Reduce the day-of-month increment to 31 or less.
- For intervals longer than a month, use the month field.
- Validate step values against 31 for the day-of-month field before building the expression.
Example fix
// before "0 0 0 1/45 * ?" // after "0 0 0 1/15 * ?"
Defensive patterns
Strategy: validation
Validate before calling
// Validate step increment for day-of-month (field index 3)
String[] parts = cron.trim().split("\\s+");
if (parts.length > 3 && parts[3].contains("/")) {
int step = Integer.parseInt(parts[3].substring(parts[3].indexOf("/") + 1));
if (step > 31) throw new IllegalArgumentException("Day-of-month step must be <= 31: " + step);
} Type guard
boolean isValidDayOfMonthStep(String domField) {
if (!domField.contains("/")) return true;
int step = Integer.parseInt(domField.substring(domField.indexOf("/") + 1));
return step >= 1 && step <= 31; Try / catch
try {
new CronExpression(cron);
} catch (ParseException e) {
if (e.getMessage().contains("Increment >= 31")) {
// switch to month-based scheduling
}
} Prevention
- Clamp day-of-month step values to 1-31 before building the expression.
- For intervals longer than a month, use the month field.
- Validate increments against each field's domain maximum.
When it happens
Trigger: A cron expression like '0 0 0 1/32 * ?' where the increment after '/' in the day-of-month field is >= 32. The check at line 731 tests incr > 31 with type DAY_OF_MONTH.
Common situations: Generating a day-of-month increment dynamically without bounds checking, or confusing the day-of-month maximum with another field's.
Related errors
- Increment >= 60 : {}
- Increment >= 24 : {}
- Increment >= 7 : {}
- Increment >= 12 : {}
- Unexpected character '{}' after '/'
AI-assisted analysis of xuxueli/xxl-job@e74c784f68 (2026-08-14).
Data as JSON: /api/errors/0971d06ccf221107.
Report an issue: GitHub.