alibaba/spring-cloud-alibaba · error · ParseException
Increment > 7 : {}
Error message
Increment > 7 : {} What it means
Thrown when a step value after '/' exceeds 7 in the DAY_OF_WEEK field (guard at CronExpression.java:444-445). Day-of-week values run 1 (SUN) through 7 (SAT), so a step larger than 7 is rejected.
Source
Thrown at spring-cloud-alibaba-starters/spring-cloud-starter-alibaba-schedulerx/src/main/java/com/alibaba/cloud/scheduling/schedulerx/util/CronExpression.java:445
}
incr = getNumericValue(s, i);
i++;
if (incr > 10) {
i++;
}
if (incr > 59 && (type == SECOND || type == MINUTE)) {
throw new ParseException("Increment > 60 : " + incr, i);
}
else if (incr > 23 && (type == HOUR)) {
throw new ParseException("Increment > 24 : " + incr, i);
}
else if (incr > 31 && (type == DAY_OF_MONTH)) {
throw new ParseException("Increment > 31 : " + incr, i);
}
else if (incr > 7 && (type == DAY_OF_WEEK)) {
throw new ParseException("Increment > 7 : " + incr, i);
}
else if (incr > 12 && (type == MONTH)) {
throw new ParseException("Increment > 12 : " + incr, i);
}
}
else {
incr = 1;
}
addToSet(ALL_SPEC_INT, -1, incr, type);
return i;
}
else if (c == 'L') {
i++;
if (type == DAY_OF_MONTH) {
lastdayOfMonth = true;
}
if (type == DAY_OF_WEEK) {View on GitHub (pinned to 115d590110)
Solutions
- Use a day-of-week step <= 7, e.g. '*/8' -> '*/2'.
- Remember weekdays are 1-7 here (SUN=1...SAT=7).
- If you need 'every other week', cron steps cannot express it; use a fixed schedule or an external trigger.
Example fix
// before
new CronExpression("0 0 0 ? * */8");
// after
new CronExpression("0 0 0 ? * */2"); // every 2 days-of-week Defensive patterns
Strategy: validation
Validate before calling
static boolean stepWithin(String field, int max) {
int slash = field.indexOf('/');
if (slash < 0) return true;
try { return Integer.parseInt(field.substring(slash + 1)) <= max; }
catch (NumberFormatException e) { return false; }
} Try / catch
try {
CronExpression cron = new CronExpression(raw);
} catch (ParseException e) {
throw new IllegalArgumentException("Invalid cron expression: " + raw, e);
} Prevention
- Day-of-week is 1-7 (SUN=1 ... SAT=7); steps cap at 7.
- Cron steps cannot model 'every N weeks'; use a fixed calendar or external trigger.
- Validate weekday numbering against this parser's dayMap.
When it happens
Trigger: `new CronExpression("0 0 0 ? * */8")` (day-of-week step 8) or any step > 7 in the day-of-week position.
Common situations: Confusion between 0-based and 1-based weekday numbering, or a step meant for another field landing in day-of-week due to a field-count mistake.
Related errors
- Increment > 60 : {}
- Increment > 24 : {}
- Increment > 31 : {}
- Increment > 12 : {}
- Offset from last day must be <= 30
AI-assisted analysis of alibaba/spring-cloud-alibaba@115d590110 (2026-08-14).
Data as JSON: /api/errors/4675e6c27fb347dd.
Report an issue: GitHub.